Chromium Code Reviews| Index: tests/json/json_test.dart |
| diff --git a/tests/json/json_test.dart b/tests/json/json_test.dart |
| index 1c7e4441248cb502e46b6587a0fcc634acc63565..3dfe93b19304e8c02155cc55ec84d583129d7d72 100644 |
| --- a/tests/json/json_test.dart |
| +++ b/tests/json/json_test.dart |
| @@ -3,14 +3,14 @@ |
| // BSD-style license that can be found in the LICENSE file. |
| library json_tests; |
| -import "package:expect/expect.dart"; |
| + |
| import "dart:convert"; |
| -import 'dart:html'; |
| -import '../../pkg/unittest/lib/unittest.dart'; |
| -import '../../pkg/unittest/lib/html_config.dart'; |
| -main() { |
| - useHtmlConfiguration(); |
| +import 'package:unittest/unittest.dart'; |
| + |
| +//TODO(kevmoo): merge these with tests in tests/lib/convert |
| + |
|
Lasse Reichstein Nielsen
2014/03/26 11:41:31
Just move the file to test/lib/convert/json2_test.
kevmoo
2014/03/26 16:34:34
Done.
|
| +void main() { |
| test('Parse', () { |
| // Scalars. |
| expect(JSON.decode(' 5 '), equals(5)); |
| @@ -85,9 +85,8 @@ main() { |
| expect(JSON.encode(null), equals('null')); |
| expect(JSON.encode(' hi there" bob '), equals('" hi there\\" bob "')); |
| expect(JSON.encode('hi\\there'), equals('"hi\\\\there"')); |
| - // TODO(devoncarew): these tests break the dartium build |
| - //expect(JSON.encode('hi\nthere'), equals('"hi\\nthere"')); |
| - //expect(JSON.encode('hi\r\nthere'), equals('"hi\\r\\nthere"')); |
| + expect(JSON.encode('hi\nthere'), equals('"hi\\nthere"')); |
| + expect(JSON.encode('hi\r\nthere'), equals('"hi\\r\\nthere"')); |
| expect(JSON.encode(''), equals('""')); |
| // Lists. |
| @@ -119,14 +118,9 @@ main() { |
| expect(JSON.encode(new ToJson([4, new ToJson({"x":42})])), |
| '[4,{"x":42}]'); |
| - Expect.throws(() { |
| - JSON.encode([new ToJson(new ToJson(4))]); |
| - }); |
| - |
| - Expect.throws(() { |
| - JSON.encode([new Object()]); |
| - }); |
| + expect(() => JSON.encode([new ToJson(new ToJson(4))]), throws); |
| + expect(() => JSON.encode([new Object()]), throws); |
| }); |
| test('stringify throws if argument cannot be converted', () { |