chiark / gitweb /
v0.06
[nailing-cargo.git] / t / toml-test / invalid / table-array-implicit.t
1 # File automatically generated from BurntSushi/toml-test
2 use utf8;
3 use Test2::V0;
4 use TOML::Tiny;
5
6 binmode STDIN,  ':encoding(UTF-8)';
7 binmode STDOUT, ':encoding(UTF-8)';
8
9 ok dies(sub{
10   from_toml(q{
11 # This test is a bit tricky. It should fail because the first use of
12 # `[[albums.songs]]` without first declaring `albums` implies that `albums`
13 # must be a table. The alternative would be quite weird. Namely, it wouldn't
14 # comply with the TOML spec: "Each double-bracketed sub-table will belong to 
15 # the most *recently* defined table element *above* it."
16 #
17 # This is in contrast to the *valid* test, table-array-implicit where
18 # `[[albums.songs]]` works by itself, so long as `[[albums]]` isn't declared
19 # later. (Although, `[albums]` could be.)
20 [[albums.songs]]
21 name = "Glory Days"
22
23 [[albums]]
24 name = "Born in the USA"
25
26   }, strict_arrays => 1);
27 }), 'strict_mode dies on table-array-implicit';
28
29 done_testing;