@@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php';
15
15
16
16
17
17
Assert::same (
18
- ' [true, " TRUE", " tRuE", " true" , false, " FALSE", " fAlSe", " false" , null, " NULL", " nUlL", " null", " yes", "no", "on", " off"] ' ,
18
+ " [true, ' TRUE', ' tRuE', ' true' , false, ' FALSE', ' fAlSe', ' false' , null, ' NULL', ' nUlL', ' null', ' yes', 'no', 'on', ' off'] " ,
19
19
Neon::encode ([
20
20
true , 'TRUE ' , 'tRuE ' , 'true ' ,
21
21
false , 'FALSE ' , 'fAlSe ' , 'false ' ,
@@ -25,27 +25,47 @@ Assert::same(
25
25
);
26
26
27
27
Assert::same (
28
- ' [1, 1.0, 0, 0.0, -1, -1.2, "1", " 1.0", "-1"] ' ,
28
+ " [1, 1.0, 0, 0.0, -1, -1.2, '1', ' 1.0', '-1'] " ,
29
29
Neon::encode ([1 , 1.0 , 0 , 0.0 , -1 , -1.2 , '1 ' , '1.0 ' , '-1 ' ])
30
30
);
31
31
32
32
Assert::same (
33
- ' ["1", " 0xAA", " 0o12", " 0b110", "+1", "-1", " .50", " 1e10"] ' ,
33
+ " ['1', ' 0xAA', ' 0o12', ' 0b110', '+1', '-1', ' .50', ' 1e10'] " ,
34
34
Neon::encode (['1 ' , '0xAA ' , '0o12 ' , '0b110 ' , '+1 ' , '-1 ' , '.50 ' , '1e10 ' ])
35
35
);
36
36
37
37
Assert::same (
38
- ' [\, " \' ", "\"", "\r", " \\ \\ \r"] ' ,
39
- Neon::encode (['\\' , "' " , '" ' , "\r " , "\\ \r " ])
38
+ " [ \\ , '''', ' \" ', ''' \n\n\n ''', ''' \n\t \\ \n\n '''] " ,
39
+ Neon::encode (['\\' , "' " , '" ' , "\n " , "\\ \n " ])
40
40
);
41
41
42
42
Assert::same (
43
- "{multi: [ \"\"\"\n\tone \n\ttwo \n\tthree \\\\ne \"' \t\n\"\"\"]} " ,
43
+ "''' \n\taaa \n\t'''bbb \n''' " ,
44
+ Neon::encode ("aaa \n'''bbb " )
45
+ );
46
+
47
+ Assert::same (
48
+ "\"\"\"\n\taaa \n\t \t'''bbb \n\"\"\"" ,
49
+ Neon::encode ("aaa \n \t'''bbb " )
50
+ );
51
+
52
+ Assert::same (
53
+ "''' \n\taaa''' \n\tbbb \n''' " ,
54
+ Neon::encode ("aaa''' \nbbb " )
55
+ );
56
+
57
+ Assert::same (
58
+ "\"\"\"\n\taaa \n\t \t'''bbb \n\t \t\"\"\\\"ccc \n\"\"\"" ,
59
+ Neon::encode ("aaa \n \t'''bbb \n \t\"\"\"ccc " )
60
+ );
61
+
62
+ Assert::same (
63
+ "{multi: [''' \n\tone \n\ttwo \n\tthree \\ne \"' \t\n''']} " ,
44
64
Neon::encode (['multi ' => ["one \ntwo \nthree \\ne \"' \t" ]])
45
65
);
46
66
47
67
Assert::same (
48
- ' ["[", "]", "{", "}", ":", ": ", "=", "#"] ' ,
68
+ " ['[', ']', '{', '}', ':', ': ', '=', '#'] " ,
49
69
Neon::encode (['[ ' , '] ' , '{ ' , '} ' , ': ' , ': ' , '= ' , '# ' ])
50
70
);
51
71
@@ -92,7 +112,7 @@ Assert::same(
92
112
);
93
113
94
114
Assert::same (
95
- ' " ,žlu/ťoučký" ' ,
115
+ " ' ,žlu/ťoučký' " ,
96
116
Neon::encode (',žlu/ťoučký ' )
97
117
);
98
118
@@ -144,7 +164,3 @@ Assert::same(
144
164
'[] ' ,
145
165
Neon::encode ([], Neon::BLOCK )
146
166
);
147
-
148
- Assert::exception (function () {
149
- Neon::encode ("a invalid utf8 char sequence: \xc2\x82\x28\xfc\xa1\xa1\xa1\xa1\xa1\xe2\x80\x82" );
150
- }, Nette \Neon \Exception::class);
0 commit comments