chiark / gitweb /
8ac171ffebcb487a70aff220c405776df7417251
[nailing-cargo.git] / t / toml-test / valid / 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                'equivalent_three' => 'The quick brown fox jumps over the lazy dog.',
12                'equivalent_one' => 'The quick brown fox jumps over the lazy dog.',
13                'equivalent_two' => 'The quick brown fox jumps over the lazy dog.',
14                'multiline_empty_four' => '',
15                'multiline_empty_one' => '',
16                'multiline_empty_two' => '',
17                'multiline_empty_three' => ''
18              };
19
20
21 my $actual = from_toml(q{multiline_empty_one = """"""
22 multiline_empty_two = """
23 """
24 multiline_empty_three = """\\
25     """
26 multiline_empty_four = """\\
27    \\
28    \\
29    """
30
31 equivalent_one = "The quick brown fox jumps over the lazy dog."
32 equivalent_two = """
33 The quick brown \\
34
35
36   fox jumps over \\
37     the lazy dog."""
38
39 equivalent_three = """\\
40        The quick brown \\
41        fox jumps over \\
42        the lazy dog.\\
43        """
44 });
45
46 is($actual, $expected1, 'multiline-string - from_toml') or do{
47   diag 'EXPECTED:';
48   diag Dumper($expected1);
49
50   diag 'ACTUAL:';
51   diag Dumper($actual);
52 };
53
54 is(eval{ from_toml(to_toml($actual)) }, $actual, 'multiline-string - to_toml') or do{
55   diag 'INPUT:';
56   diag Dumper($actual);
57
58   diag 'TOML OUTPUT:';
59   diag to_toml($actual);
60
61   diag 'REPARSED OUTPUT:';
62   diag Dumper(from_toml(to_toml($actual)));
63 };
64
65 done_testing;