1 |
wakaba |
1.1 |
#!/usr/bin/perl |
2 |
|
|
use strict; |
3 |
|
|
require Message::Markup::SuikaWikiConfig20::Parser; |
4 |
|
|
|
5 |
|
|
my $cfg = Message::Markup::SuikaWikiConfig20::Parser->new; |
6 |
|
|
|
7 |
|
|
require Test::Simple; |
8 |
|
|
my $t = q(foo: aiueo |
9 |
|
|
#comment |
10 |
|
|
#(multiple lines) |
11 |
|
|
|
12 |
|
|
#comment |
13 |
|
|
#(multiple lines) |
14 |
|
|
foo: val |
15 |
|
|
foo: |
16 |
|
|
value |
17 |
|
|
with multiple |
18 |
|
|
\ lines |
19 |
|
|
multiple lines: val |
20 |
|
|
foo: |
21 |
|
|
value |
22 |
|
|
with multiple |
23 |
|
|
\@ lines |
24 |
|
|
\\\\ escaped |
25 |
|
|
\ |
26 |
|
|
name: |
27 |
|
|
@@: val |
28 |
|
|
@foo: bar |
29 |
|
|
@foo: 0 |
30 |
|
|
@\@: \@ foo |
31 |
|
|
@foo: |
32 |
|
|
something multi |
33 |
|
|
\ |
34 |
|
|
\ line |
35 |
|
|
@foo: |
36 |
|
|
@@@: |
37 |
|
|
something\ |
38 |
|
|
\ multi |
39 |
|
|
\ |
40 |
|
|
\ line |
41 |
|
|
@@foo: bar |
42 |
|
|
@@foo: 0 |
43 |
|
|
@@\@: \@ foo |
44 |
|
|
@@foo: |
45 |
|
|
something\ |
46 |
|
|
\ multi |
47 |
|
|
\ |
48 |
|
|
\ line |
49 |
|
|
@@foolist[list]: |
50 |
|
|
foo |
51 |
|
|
bar |
52 |
|
|
\#baz |
53 |
|
|
bar |
54 |
|
|
###COMMENT## |
55 |
|
|
); |
56 |
|
|
|
57 |
|
|
my $parsed = $cfg->parse_text ($t); |
58 |
|
|
|
59 |
|
|
my @s = split /\n/, $parsed->stringify; |
60 |
|
|
my @t = split /\n/, $t; |
61 |
|
|
|
62 |
|
|
Test::Simple->import (tests => scalar @t); |
63 |
|
|
for (0..($#t > $#s ? $#t : $#s)) { |
64 |
|
|
ok ($s[$_] eq $t[$_], "Line $_ : '$s[$_]' '$t[$_]'"); |
65 |
|
|
} |