import rt 3.6.6
[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;
29 use HTML::Mason::Compiler;
30 use HTML::Mason::Compiler::ToObject;
31
32 sub compile_file {
33     my $file = shift;
34
35     open my $fh, '<:utf8', $file or die "couldn't open '$file': $!";
36     my $text = do { local $/; <$fh> };
37     close $fh or die "couldn't close '$file': $!";
38
39     my $compiler = new HTML::Mason::Compiler::ToObject;
40     $compiler->compile(
41         comp_source => $text,
42         name => 'my',
43         $HTML::Mason::VERSION >= 1.36? (comp_path => 'my'): (),
44     );
45     return 1;
46 }
47