00-mason-syntax.t 835 Bytes
Newer Older
1
2
3
use strict;
use warnings;

4
use RT::Test nodb => 1;
5
6
7
8
9
10


use File::Find;
find( {
    no_chdir => 1,
    wanted   => sub {
Ruslan Zakirov's avatar
Ruslan Zakirov committed
11
        return if /(?:\.(?:jpe?g|png|gif|rej)|\~)$/i;
12
        return if m{/\.[^/]+\.sw[op]$}; # vim swap files
13
        return unless -f $_;
14
15
        local ($@);
        ok( eval { compile_file($_) }, "Compiled $File::Find::name ok: $@");
16
    },
17
}, RT::Test::get_relocatable_dir('../share/html'));
18

19
use HTML::Mason;
20
21
use HTML::Mason::Compiler;
use HTML::Mason::Compiler::ToObject;
Ruslan Zakirov's avatar
Ruslan Zakirov committed
22
BEGIN { require RT::Test; }
23
use Encode;
24
25
26
27

sub compile_file {
    my $file = shift;

28
    my $text = Encode::decode( "UTF-8", RT::Test->file_content($file));
29
30

    my $compiler = new HTML::Mason::Compiler::ToObject;
31
32
33
    $compiler->compile(
        comp_source => $text,
        name => 'my',
34
        comp_path => 'my',
35
    );
36
37
38
    return 1;
}