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

Unified Diff: tests/json/json_test.dart

Issue 212643007: Revert "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
« no previous file with comments | « tests/json/json.status ('k') | tests/lib/convert/json2_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/json/json_test.dart
diff --git a/tests/lib/convert/json2_test.dart b/tests/json/json_test.dart
similarity index 90%
rename from tests/lib/convert/json2_test.dart
rename to tests/json/json_test.dart
index cfb3514241e136b83f855932de5e634e348b1e71..1c7e4441248cb502e46b6587a0fcc634acc63565 100644
--- a/tests/lib/convert/json2_test.dart
+++ b/tests/json/json_test.dart
@@ -2,15 +2,15 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library json2_tests;
-
+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';
-import 'package:unittest/unittest.dart';
-
-// Moved from "tests/json/json_test.dart"
-
-void main() {
+main() {
+ useHtmlConfiguration();
test('Parse', () {
// Scalars.
expect(JSON.decode(' 5 '), equals(5));
@@ -85,8 +85,9 @@ void 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"'));
- expect(JSON.encode('hi\nthere'), equals('"hi\\nthere"'));
- expect(JSON.encode('hi\r\nthere'), equals('"hi\\r\\nthere"'));
+ // 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(''), equals('""'));
// Lists.
@@ -118,9 +119,14 @@ void main() {
expect(JSON.encode(new ToJson([4, new ToJson({"x":42})])),
'[4,{"x":42}]');
- expect(() => JSON.encode([new ToJson(new ToJson(4))]), throws);
+ Expect.throws(() {
+ JSON.encode([new ToJson(new ToJson(4))]);
+ });
+
+ Expect.throws(() {
+ JSON.encode([new Object()]);
+ });
- expect(() => JSON.encode([new Object()]), throws);
});
test('stringify throws if argument cannot be converted', () {
@@ -162,6 +168,6 @@ class ToJson {
* Checks that the argument can be converted to a JSON string and
* back, and produce something equivalent to the argument.
*/
-void validateRoundTrip(expected) {
+validateRoundTrip(expected) {
expect(JSON.decode(JSON.encode(expected)), equals(expected));
}
« no previous file with comments | « tests/json/json.status ('k') | tests/lib/convert/json2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698