Commit | Line | Data |
e5459d76 |
1 | #!/usr/bin/env perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | use Test::More; |
6 | use Test::Exception; |
7 | # setup library path |
8 | use FindBin qw($Bin); |
9 | use lib "$Bin/lib"; |
10 | use Data::Dumper; |
22c77d41 |
11 | use Moose::Autobox; |
e5459d76 |
12 | my $path = "$Bin/lib/TestApp/root/"; |
13 | |
14 | use_ok 'CatalystX::HelpText::Script::SearchUndocumentedHelpText'; |
22c77d41 |
15 | |
16 | foreach my $suffix ('', '::Regexp') { |
17 | |
18 | my $class = "CatalystX::HelpText::Finder::TemplateToolkit" . $suffix; |
19 | my $script; |
20 | lives_ok { |
21 | $script = CatalystX::HelpText::Script::SearchUndocumentedHelpText->new( |
e5459d76 |
22 | help_files_path => "$path/helptext", |
23 | template_search_dir => "$path", |
22c77d41 |
24 | finder_class => $class, |
e5459d76 |
25 | filename_pattern => '\W', |
26 | ); |
22c77d41 |
27 | } "don't break"; |
28 | |
29 | my @files = ( |
30 | $path.'difficult', |
31 | $path.'undocumented', |
32 | $path.'main', |
33 | $path.'helptext/fnoo.html', |
34 | ); |
8137c236 |
35 | is_deeply [ sort $script->all_files->flatten ], [ sort @files ], "Files found for class '$class'" or diag Dumper($script->all_files); |
83a34a14 |
36 | is_deeply [ sort $script->all_keys->flatten ], [ sort 'undocumented', 'fnoo', 'one', 'two', 'pass', ], "All keys found for class '$class'" or diag Dumper($script->all_keys); |
37 | is_deeply [ sort $script->undocumented_keys->flatten ], [ sort 'one', 'two', 'undocumented', 'pass' ], "undocumented keys found for class '$class'" or diag Dumper($script->undocumented_keys); |
38 | is_deeply [ sort $script->documented_keys->flatten ], [ sort 'fnoo', ], "documented keys found for class '$class'" or diag Dumper($script->documented_keys); |
22c77d41 |
39 | } |
e5459d76 |
40 | |
41 | done_testing; |