@@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php';
1515
1616
1717Assert::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'] " ,
1919 Neon::encode ([
2020 true , 'TRUE ' , 'tRuE ' , 'true ' ,
2121 false , 'FALSE ' , 'fAlSe ' , 'false ' ,
@@ -25,27 +25,47 @@ Assert::same(
2525);
2626
2727Assert::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'] " ,
2929 Neon::encode ([1 , 1.0 , 0 , 0.0 , -1 , -1.2 , '1 ' , '1.0 ' , '-1 ' ])
3030);
3131
3232Assert::same (
33- ' ["1", " 0xAA", " 0o12", " 0b110", "+1", "-1", " .50", " 1e10"] ' ,
33+ " ['1', ' 0xAA', ' 0o12', ' 0b110', '+1', '-1', ' .50', ' 1e10'] " ,
3434 Neon::encode (['1 ' , '0xAA ' , '0o12 ' , '0b110 ' , '+1 ' , '-1 ' , '.50 ' , '1e10 ' ])
3535);
3636
3737Assert::same (
38- ' [\, " \' ", "\"", "\r", " \\ \\ \r"] ' ,
39- Neon::encode (['\\' , "' " , '" ' , "\r " , "\\ \r " ])
38+ " [ \\ , '''', ' \" ', ''' \n\n\n ''', ''' \n\t \\ \n\n '''] " ,
39+ Neon::encode (['\\' , "' " , '" ' , "\n " , "\\ \n " ])
4040);
4141
4242Assert::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''']} " ,
4464 Neon::encode (['multi ' => ["one \ntwo \nthree \\ne \"' \t" ]])
4565);
4666
4767Assert::same (
48- ' ["[", "]", "{", "}", ":", ": ", "=", "#"] ' ,
68+ " ['[', ']', '{', '}', ':', ': ', '=', '#'] " ,
4969 Neon::encode (['[ ' , '] ' , '{ ' , '} ' , ': ' , ': ' , '= ' , '# ' ])
5070);
5171
@@ -92,7 +112,7 @@ Assert::same(
92112);
93113
94114Assert::same (
95- ' " ,žlu/ťoučký" ' ,
115+ " ' ,žlu/ťoučký' " ,
96116 Neon::encode (',žlu/ťoučký ' )
97117);
98118
@@ -144,7 +164,3 @@ Assert::same(
144164 '[] ' ,
145165 Neon::encode ([], Neon::BLOCK )
146166);
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