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