SMS-OVH

SMS::OVH - Send SMS using OVH API (https://api.ovh.com/)
git clone https://git.e1e0.net/SMS-OVH.git
Log | Files | Refs | README

boilerplate.t (1330B)


      1 #!perl -T
      2 use 5.006;
      3 use strict;
      4 use warnings;
      5 use Test::More;
      6 
      7 plan tests => 3;
      8 
      9 sub not_in_file_ok {
     10     my ($filename, %regex) = @_;
     11     open( my $fh, '<', $filename )
     12         or die "couldn't open $filename for reading: $!";
     13 
     14     my %violated;
     15 
     16     while (my $line = <$fh>) {
     17         while (my ($desc, $regex) = each %regex) {
     18             if ($line =~ $regex) {
     19                 push @{$violated{$desc}||=[]}, $.;
     20             }
     21         }
     22     }
     23 
     24     if (%violated) {
     25         fail("$filename contains boilerplate text");
     26         diag "$_ appears on lines @{$violated{$_}}" for keys %violated;
     27     } else {
     28         pass("$filename contains no boilerplate text");
     29     }
     30 }
     31 
     32 sub module_boilerplate_ok {
     33     my ($module) = @_;
     34     not_in_file_ok($module =>
     35         'the great new $MODULENAME'   => qr/ - The great new /,
     36         'boilerplate description'     => qr/Quick summary of what the module/,
     37         'stub function definition'    => qr/function[12]/,
     38     );
     39 }
     40 
     41 TODO: {
     42   local $TODO = "Need to replace the boilerplate text";
     43 
     44   not_in_file_ok(README =>
     45     "The README is used..."       => qr/The README is used/,
     46     "'version information here'"  => qr/to provide version information/,
     47   );
     48 
     49   not_in_file_ok(Changes =>
     50     "placeholder date/time"       => qr(Date/time)
     51   );
     52 
     53   module_boilerplate_ok('lib/SMS/OVH.pm');
     54 
     55 
     56 }
     57