chiark / gitweb /
d1aac75fcedee042b3f24d6d870c3d9aace41235
[nailing-cargo.git] / t / toml-test / valid / raw-string.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                'formfeed' => 'This string has a \\f form feed character.',
12                'slash' => 'This string has a \\/ slash character.',
13                'carriage' => 'This string has a \\r carriage return character.',
14                'tab' => 'This string has a \\t tab character.',
15                'backspace' => 'This string has a \\b backspace character.',
16                'newline' => 'This string has a \\n new line character.',
17                'backslash' => 'This string has a \\\\ backslash character.'
18              };
19
20
21 my $actual = from_toml(q{backspace = 'This string has a \\b backspace character.'
22 tab = 'This string has a \\t tab character.'
23 newline = 'This string has a \\n new line character.'
24 formfeed = 'This string has a \\f form feed character.'
25 carriage = 'This string has a \\r carriage return character.'
26 slash = 'This string has a \\/ slash character.'
27 backslash = 'This string has a \\\\ backslash character.'
28 });
29
30 is($actual, $expected1, 'raw-string - from_toml') or do{
31   diag 'EXPECTED:';
32   diag Dumper($expected1);
33
34   diag 'ACTUAL:';
35   diag Dumper($actual);
36 };
37
38 is(eval{ from_toml(to_toml($actual)) }, $actual, 'raw-string - to_toml') or do{
39   diag 'INPUT:';
40   diag Dumper($actual);
41
42   diag 'TOML OUTPUT:';
43   diag to_toml($actual);
44
45   diag 'REPARSED OUTPUT:';
46   diag Dumper(from_toml(to_toml($actual)));
47 };
48
49 done_testing;