This commit was generated by cvs2svn to compensate for changes in r9232,
[freeside.git] / rt / t / 00-mason-syntax.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use RT::Test tests => 1;
7
8 my $ok = 1;
9
10 use File::Find;
11 find( {
12     no_chdir => 1,
13     wanted   => sub {
14         return if /(?:\.(?:jpe?g|png|gif|rej)|\~)$/i;
15         return if m{/\.[^/]+\.swp$}; # vim swap files
16         return unless -f $_;
17         diag "testing $_" if $ENV{'TEST_VERBOSE'};
18         eval { compile_file($_) } and return;
19         $ok = 0;
20         diag "error in ${File::Find::name}:\n$@";
21     },
22 }, RT::Test::get_relocatable_dir('../share/html'));
23 ok($ok, "mason syntax is ok");
24
25 use HTML::Mason;
26 use HTML::Mason::Compiler;
27 use HTML::Mason::Compiler::ToObject;
28 BEGIN { require RT::Test; }
29 use Encode qw(decode_utf8);
30
31 sub compile_file {
32     my $file = shift;
33
34     my $text = decode_utf8(RT::Test->file_content($file));
35
36     my $compiler = new HTML::Mason::Compiler::ToObject;
37     $compiler->compile(
38         comp_source => $text,
39         name => 'my',
40         $HTML::Mason::VERSION >= 1.36? (comp_path => 'my'): (),
41     );
42     return 1;
43 }
44