chiark / gitweb /
v0.06
[nailing-cargo.git] / t / toml-test / valid / inline-table-array.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                'people' => [
16                              {
17                                'last_name' => 'Springsteen',
18                                'first_name' => 'Bruce'
19                              },
20                              {
21                                'last_name' => 'Clapton',
22                                'first_name' => 'Eric'
23                              },
24                              {
25                                'first_name' => 'Bob',
26                                'last_name' => 'Seger'
27                              }
28                            ]
29              };
30
31
32 my $actual = from_toml(q{people = [{first_name = "Bruce", last_name = "Springsteen"},
33           {first_name = "Eric", last_name = "Clapton"},
34           {first_name = "Bob", last_name = "Seger"}]
35 });
36
37 is($actual, $expected1, 'inline-table-array - from_toml') or do{
38   diag 'EXPECTED:';
39   diag Dumper($expected1);
40
41   diag 'ACTUAL:';
42   diag Dumper($actual);
43 };
44
45 is(eval{ from_toml(to_toml($actual)) }, $actual, 'inline-table-array - to_toml') or do{
46   diag 'INPUT:';
47   diag Dumper($actual);
48
49   diag 'TOML OUTPUT:';
50   diag to_toml($actual);
51
52   diag 'REPARSED OUTPUT:';
53   diag Dumper(from_toml(to_toml($actual)));
54 };
55
56 done_testing;