chiark / gitweb /
04fe42ea52143aaca4f765e7fac6316cae3b8d6f
[nailing-cargo.git] / t / toml-test / valid / table-array-table-array.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                'a' => [
12                         {
13                           'b' => [
14                                    {
15                                      'c' => {
16                                               'd' => 'val0'
17                                             }
18                                    },
19                                    {
20                                      'c' => {
21                                               'd' => 'val1'
22                                             }
23                                    }
24                                  ]
25                         }
26                       ]
27              };
28
29
30 my $actual = from_toml(q{[[a]]
31     [[a.b]]
32         [a.b.c]
33             d = "val0"
34     [[a.b]]
35         [a.b.c]
36             d = "val1"
37 });
38
39 is($actual, $expected1, 'table-array-table-array - from_toml') or do{
40   diag 'EXPECTED:';
41   diag Dumper($expected1);
42
43   diag 'ACTUAL:';
44   diag Dumper($actual);
45 };
46
47 is(eval{ from_toml(to_toml($actual)) }, $actual, 'table-array-table-array - to_toml') or do{
48   diag 'INPUT:';
49   diag Dumper($actual);
50
51   diag 'TOML OUTPUT:';
52   diag to_toml($actual);
53
54   diag 'REPARSED OUTPUT:';
55   diag Dumper(from_toml(to_toml($actual)));
56 };
57
58 done_testing;