-
Notifications
You must be signed in to change notification settings - Fork 5
/
t01.t
32 lines (26 loc) · 909 Bytes
/
t01.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env perl6
use v6;
use Test;
use Plosurin;
#my $tmpl = '{import file="some/test.pod" rule="!head,:private"}';
#if Plosurin::Template.parse($tmpl, :actions(Plosurin::TActions.new)
# ) { "OK".say} else { "BAD".say };
#say $/.pretty;
#say $/.ast.values.^methods().sort().uniq().join(', ').elems;
#say $/.ast.^methods().join(', ');
#say 'POS: ' ~ $/.CURSOR.pos ~ 'chars: ' ~ $/.orig.chars;
my @lexer_tests =
'<div>Text</div></div>',
[{'Plo::raw_text' => [] }],
'raw text',
'{ print $arrt }',
[{"Plo::command_print" => []}],
0,
'{import file="some/test.pod" rule="!head,:private"}',
[{"Plo::command_import" => {"file" => "some/test.pod", "rule" => "!head,:private"}}],
0,
;
for @lexer_tests -> $template, $check, $test_name {
my $res = Plosurin::Template.parse($template, :actions(Plosurin::TActions.new));
is_deeply [ $/.ast».dumper],$check, $test_name ?? $test_name !! $template;
}