Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1105)

Unified Diff: tests/json/json_test.dart

Issue 208273003: Fix JSON tests, re-enable in all cases (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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', () {
« no previous file with comments | « tests/json/json.status ('k') | tests/json/pubspec.yaml » ('j') | tests/json/pubspec.yaml » ('J')

Powered by Google App Engine
This is Rietveld 408576698