import rt 3.6.4
[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         if (m!/\.svn$!) {
16             $File::Find::prune = 1;
17             return;
18         }
19         return unless -f $_;
20         diag "testing $_" if $ENV{'TEST_VERBOSE'};
21         eval { compile_file($_) } and return;
22         $ok = 0;
23         diag "error in ${File::Find::name}:\n$@";
24     },
25 }, 'html');
26 ok($ok, "mason syntax is ok");
27
28 use HTML::Mason::Compiler;
29 use HTML::Mason::Compiler::ToObject;
30
31 sub compile_file {
32     my $file = shift;
33
34     open my $fh, '<:utf8', $file or die "couldn't open '$file': $!";
35     my $text = do { local $/; <$fh> };
36     close $fh or die "couldn't close '$file': $!";
37
38     my $compiler = new HTML::Mason::Compiler::ToObject;
39     $compiler->compile( comp_source => $text, name => 'my' );
40     return 1;
41 }
42