diff options
Diffstat (limited to 't')
-rw-r--r-- | t/00-load.t | 9 | ||||
-rw-r--r-- | t/boilerplate.t | 48 | ||||
-rw-r--r-- | t/pod-coverage.t | 6 | ||||
-rw-r--r-- | t/pod.t | 6 |
4 files changed, 69 insertions, 0 deletions
diff --git a/t/00-load.t b/t/00-load.t new file mode 100644 index 0000000..786b9cd --- /dev/null +++ b/t/00-load.t | |||
@@ -0,0 +1,9 @@ | |||
1 | #!perl -T | ||
2 | |||
3 | use Test::More tests => 1; | ||
4 | |||
5 | BEGIN { | ||
6 | use_ok( 'DJabberd::RosterStorage::SQLite::Fixed' ); | ||
7 | } | ||
8 | |||
9 | diag( "Testing DJabberd::RosterStorage::SQLite::Fixed $DJabberd::RosterStorage::SQLite::Fixed::VERSION, Perl $], $^X" ); | ||
diff --git a/t/boilerplate.t b/t/boilerplate.t new file mode 100644 index 0000000..824d393 --- /dev/null +++ b/t/boilerplate.t | |||
@@ -0,0 +1,48 @@ | |||
1 | #!perl -T | ||
2 | |||
3 | use strict; | ||
4 | use warnings; | ||
5 | use Test::More tests => 3; | ||
6 | |||
7 | sub not_in_file_ok { | ||
8 | my ($filename, %regex) = @_; | ||
9 | open my $fh, "<", $filename | ||
10 | or die "couldn't open $filename for reading: $!"; | ||
11 | |||
12 | my %violated; | ||
13 | |||
14 | while (my $line = <$fh>) { | ||
15 | while (my ($desc, $regex) = each %regex) { | ||
16 | if ($line =~ $regex) { | ||
17 | push @{$violated{$desc}||=[]}, $.; | ||
18 | } | ||
19 | } | ||
20 | } | ||
21 | |||
22 | if (%violated) { | ||
23 | fail("$filename contains boilerplate text"); | ||
24 | diag "$_ appears on lines @{$violated{$_}}" for keys %violated; | ||
25 | } else { | ||
26 | pass("$filename contains no boilerplate text"); | ||
27 | } | ||
28 | } | ||
29 | |||
30 | not_in_file_ok(README => | ||
31 | "The README is used..." => qr/The README is used/, | ||
32 | "'version information here'" => qr/to provide version information/, | ||
33 | ); | ||
34 | |||
35 | not_in_file_ok(Changes => | ||
36 | "placeholder date/time" => qr(Date/time) | ||
37 | ); | ||
38 | |||
39 | sub module_boilerplate_ok { | ||
40 | my ($module) = @_; | ||
41 | not_in_file_ok($module => | ||
42 | 'the great new $MODULENAME' => qr/ - The great new /, | ||
43 | 'boilerplate description' => qr/Quick summary of what the module/, | ||
44 | 'stub function definition' => qr/function[12]/, | ||
45 | ); | ||
46 | } | ||
47 | |||
48 | module_boilerplate_ok('lib/DJabberd/RosterStorage/SQLite/Fixed.pm'); | ||
diff --git a/t/pod-coverage.t b/t/pod-coverage.t new file mode 100644 index 0000000..703f91d --- /dev/null +++ b/t/pod-coverage.t | |||
@@ -0,0 +1,6 @@ | |||
1 | #!perl -T | ||
2 | |||
3 | use Test::More; | ||
4 | eval "use Test::Pod::Coverage 1.04"; | ||
5 | plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@; | ||
6 | all_pod_coverage_ok(); | ||
@@ -0,0 +1,6 @@ | |||
1 | #!perl -T | ||
2 | |||
3 | use Test::More; | ||
4 | eval "use Test::Pod 1.14"; | ||
5 | plan skip_all => "Test::Pod 1.14 required for testing POD" if $@; | ||
6 | all_pod_files_ok(); | ||