import rt 3.8.9
[freeside.git] / rt / lib / t / regression / 00-mason-syntax.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More 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 unless -f $_;
16         diag "testing $_" if $ENV{'TEST_VERBOSE'};
17         eval { compile_file($_) } and return;
18         $ok = 0;
19         diag "error in ${File::Find::name}:\n$@";
20     },
21 }, 'html');
22 ok($ok, "mason syntax is ok");
23
24 use HTML::Mason;
25 use HTML::Mason::Compiler;
26 use HTML::Mason::Compiler::ToObject;
27
28 sub compile_file {
29     my $file = shift;
30
31     open my $fh, '<:utf8', $file or die "couldn't open '$file': $!";
32     my $text = do { local $/; <$fh> };
33     close $fh or die "couldn't close '$file': $!";
34
35     my $compiler = new HTML::Mason::Compiler::ToObject;
36     $compiler->compile(
37         comp_source => $text,
38         name => 'my',
39         $HTML::Mason::VERSION >= 1.36? (comp_path => 'my'): (),
40     );
41     return 1;
42 }
43