summaryrefslogtreecommitdiff
path: root/rt/t/00-mason-syntax.t
diff options
context:
space:
mode:
Diffstat (limited to 'rt/t/00-mason-syntax.t')
-rw-r--r--rt/t/00-mason-syntax.t44
1 files changed, 44 insertions, 0 deletions
diff --git a/rt/t/00-mason-syntax.t b/rt/t/00-mason-syntax.t
new file mode 100644
index 0000000..0584f63
--- /dev/null
+++ b/rt/t/00-mason-syntax.t
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use RT::Test tests => 1;
+
+my $ok = 1;
+
+use File::Find;
+find( {
+ no_chdir => 1,
+ wanted => sub {
+ return if /(?:\.(?:jpe?g|png|gif|rej)|\~)$/i;
+ return if m{/\.[^/]+\.swp$}; # vim swap files
+ return unless -f $_;
+ diag "testing $_" if $ENV{'TEST_VERBOSE'};
+ eval { compile_file($_) } and return;
+ $ok = 0;
+ diag "error in ${File::Find::name}:\n$@";
+ },
+}, RT::Test::get_relocatable_dir('../share/html'));
+ok($ok, "mason syntax is ok");
+
+use HTML::Mason;
+use HTML::Mason::Compiler;
+use HTML::Mason::Compiler::ToObject;
+BEGIN { require RT::Test; }
+use Encode qw(decode_utf8);
+
+sub compile_file {
+ my $file = shift;
+
+ my $text = decode_utf8(RT::Test->file_content($file));
+
+ my $compiler = new HTML::Mason::Compiler::ToObject;
+ $compiler->compile(
+ comp_source => $text,
+ name => 'my',
+ $HTML::Mason::VERSION >= 1.36? (comp_path => 'my'): (),
+ );
+ return 1;
+}
+