chiark / gitweb /
0d2496fbb1342ab9cea9eeedef5bcd5208054843
[nailing-cargo.git] / t / toml-test / valid / raw-multiline-string.t
1 # File automatically generated from BurntSushi/toml-test
2 use utf8;
3 use Test2::V0;
4 use Data::Dumper;
5 use TOML::Tiny;
6
7 binmode STDIN,  ':encoding(UTF-8)';
8 binmode STDOUT, ':encoding(UTF-8)';
9
10 my $expected1 = {
11                'multiline' => 'This string
12 has \' a quote character
13 and more than
14 one newline
15 in it.',
16                'firstnl' => 'This string has a \' quote character.',
17                'oneline' => 'This string has a \' quote character.'
18              };
19
20
21 my $actual = from_toml(q{oneline = '''This string has a ' quote character.'''
22 firstnl = '''
23 This string has a ' quote character.'''
24 multiline = '''
25 This string
26 has ' a quote character
27 and more than
28 one newline
29 in it.'''
30 });
31
32 is($actual, $expected1, 'raw-multiline-string - from_toml') or do{
33   diag 'EXPECTED:';
34   diag Dumper($expected1);
35
36   diag 'ACTUAL:';
37   diag Dumper($actual);
38 };
39
40 is(eval{ from_toml(to_toml($actual)) }, $actual, 'raw-multiline-string - to_toml') or do{
41   diag 'INPUT:';
42   diag Dumper($actual);
43
44   diag 'TOML OUTPUT:';
45   diag to_toml($actual);
46
47   diag 'REPARSED OUTPUT:';
48   diag Dumper(from_toml(to_toml($actual)));
49 };
50
51 done_testing;