Merge branch 'patch-5' of https://github.com/gjones2/Freeside (#13854 as this bug...
[freeside.git] / rt / t / 00-mason-syntax.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use RT::Test nodb => 1;
7
8
9 use File::Find;
10 find( {
11     no_chdir => 1,
12     wanted   => sub {
13         return if /(?:\.(?:jpe?g|png|gif|rej)|\~)$/i;
14         return if m{/\.[^/]+\.swp$}; # vim swap files
15         return unless -f $_;
16         local ($@);
17         ok( eval { compile_file($_) }, "Compiled $File::Find::name ok: $@");
18     },
19 }, RT::Test::get_relocatable_dir('../share/html'));
20
21 use HTML::Mason;
22 use HTML::Mason::Compiler;
23 use HTML::Mason::Compiler::ToObject;
24 BEGIN { require RT::Test; }
25 use Encode qw(decode_utf8);
26
27 sub compile_file {
28     my $file = shift;
29
30     my $text = decode_utf8(RT::Test->file_content($file));
31
32     my $compiler = new HTML::Mason::Compiler::ToObject;
33     $compiler->compile(
34         comp_source => $text,
35         name => 'my',
36         comp_path => 'my',
37     );
38     return 1;
39 }
40