added tests for scripts
[catagits/CatalystX-HelpText.git] / t / script.t
diff --git a/t/script.t b/t/script.t
new file mode 100644 (file)
index 0000000..49390bf
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::More;
+use Test::Exception;
+# setup library path
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+use Data::Dumper;
+my $path = "$Bin/lib/TestApp/root/";
+
+use_ok 'CatalystX::HelpText::Script::SearchUndocumentedHelpText';
+my $script;
+lives_ok {
+    $script = CatalystX::HelpText::Script::SearchUndocumentedHelpText
+        ->new_with_options(
+            help_files_path => "$path/helptext",
+            template_search_dir => "$path",
+            finder_class => "CatalystX::HelpText::Finder::TemplateToolkit",
+            filename_pattern => '\W',
+        );
+} "don't break";
+
+my $files = [
+          $path.'undocumented',
+          $path.'main',
+          $path.'helptext/fnoo.html',
+        ];
+is_deeply $script->all_files, $files, "Files found";
+is_deeply $script->all_keys, [ 'undocumented', 'fnoo' ], "All keys found";
+is_deeply $script->undocumented_keys, [ 'undocumented' ], "undocumented keys found";
+is_deeply $script->documented_keys, [ 'fnoo' ], "documented keys found";
+
+done_testing;