added tests for scripts
[catagits/CatalystX-HelpText.git] / t / script.t
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;
11 my $path = "$Bin/lib/TestApp/root/";
12
13 use_ok 'CatalystX::HelpText::Script::SearchUndocumentedHelpText';
14 my $script;
15 lives_ok {
16     $script = CatalystX::HelpText::Script::SearchUndocumentedHelpText
17         ->new_with_options(
18             help_files_path => "$path/helptext",
19             template_search_dir => "$path",
20             finder_class => "CatalystX::HelpText::Finder::TemplateToolkit",
21             filename_pattern => '\W',
22         );
23 } "don't break";
24
25 my $files = [
26           $path.'undocumented',
27           $path.'main',
28           $path.'helptext/fnoo.html',
29         ];
30 is_deeply $script->all_files, $files, "Files found";
31 is_deeply $script->all_keys, [ 'undocumented', 'fnoo' ], "All keys found";
32 is_deeply $script->undocumented_keys, [ 'undocumented' ], "undocumented keys found";
33 is_deeply $script->documented_keys, [ 'fnoo' ], "documented keys found";
34
35 done_testing;