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