OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #library('jsonTest'); | 5 library jsonTest; |
6 | 6 |
7 #import('dart:json'); | 7 import 'dart:json'; |
8 | 8 |
9 main() { | 9 main() { |
10 testEscaping(); | 10 testEscaping(); |
11 testParse(); | 11 testParse(); |
12 testParseInvalid(); | 12 testParseInvalid(); |
13 } | 13 } |
14 | 14 |
15 void testParse() { | 15 void testParse() { |
16 // Scalars. | 16 // Scalars. |
17 Expect.equals(5, JSON.parse(' 5 ')); | 17 Expect.equals(5, JSON.parse(' 5 ')); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 Expect.stringEquals('"\\u001d"', JSON.stringify('\u001d')); | 170 Expect.stringEquals('"\\u001d"', JSON.stringify('\u001d')); |
171 Expect.stringEquals('"\\u001e"', JSON.stringify('\u001e')); | 171 Expect.stringEquals('"\\u001e"', JSON.stringify('\u001e')); |
172 Expect.stringEquals('"\\u001f"', JSON.stringify('\u001f')); | 172 Expect.stringEquals('"\\u001f"', JSON.stringify('\u001f')); |
173 Expect.stringEquals('"\\\""', JSON.stringify('"')); | 173 Expect.stringEquals('"\\\""', JSON.stringify('"')); |
174 Expect.stringEquals('"\\\\"', JSON.stringify('\\')); | 174 Expect.stringEquals('"\\\\"', JSON.stringify('\\')); |
175 Expect.stringEquals('"Got \\b, \\f, \\n, \\r, \\t, \\u0000, \\\\, and \\"."', | 175 Expect.stringEquals('"Got \\b, \\f, \\n, \\r, \\t, \\u0000, \\\\, and \\"."', |
176 JSON.stringify('Got \b, \f, \n, \r, \t, \u0000, \\, and ".')); | 176 JSON.stringify('Got \b, \f, \n, \r, \t, \u0000, \\, and ".')); |
177 Expect.stringEquals('"Got \\b\\f\\n\\r\\t\\u0000\\\\\\"."', | 177 Expect.stringEquals('"Got \\b\\f\\n\\r\\t\\u0000\\\\\\"."', |
178 JSON.stringify('Got \b\f\n\r\t\u0000\\".')); | 178 JSON.stringify('Got \b\f\n\r\t\u0000\\".')); |
179 } | 179 } |
OLD | NEW |