chiark / gitweb /
9d2db1563d3682ff76fc4d942b8f4bf9b21449a2
[nailing-cargo.git] / t / toml-test / valid / key-special-chars.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                '~!@$^&*()_+-`1234567890[]|/?><.,;:\'' => bless( {
12                                                                   '_file' => '(eval 413)',
13                                                                   '_lines' => [
14                                                                                 6
15                                                                               ],
16                                                                   'code' => sub {
17                                                                                 BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x15\x00\x04\x40\x05\x04\x54"}
18                                                                                 use strict;
19                                                                                 no feature ':all';
20                                                                                 use feature ':5.16';
21                                                                                 require Math::BigInt;
22                                                                                 'Math::BigInt'->new('1')->beq($_);
23                                                                             },
24                                                                   'operator' => 'CODE(...)',
25                                                                   'name' => '<Custom Code>'
26                                                                 }, 'Test2::Compare::Custom' )
27              };
28
29
30 my $actual = from_toml(q{"~!@$^&*()_+-`1234567890[]|/?><.,;:'" = 1
31 });
32
33 is($actual, $expected1, 'key-special-chars - from_toml') or do{
34   diag 'EXPECTED:';
35   diag Dumper($expected1);
36
37   diag 'ACTUAL:';
38   diag Dumper($actual);
39 };
40
41 is(eval{ from_toml(to_toml($actual)) }, $actual, 'key-special-chars - to_toml') or do{
42   diag 'INPUT:';
43   diag Dumper($actual);
44
45   diag 'TOML OUTPUT:';
46   diag to_toml($actual);
47
48   diag 'REPARSED OUTPUT:';
49   diag Dumper(from_toml(to_toml($actual)));
50 };
51
52 done_testing;