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

Unified Diff: tests/lib/convert/json2_test.dart

Issue 212813006: Fix JSON tests, re-enable in all cases - 2nd try (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_test.dart ('k') | tests/standalone/io/status_file_parser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/convert/json2_test.dart
diff --git a/tests/json/json_test.dart b/tests/lib/convert/json2_test.dart
similarity index 90%
rename from tests/json/json_test.dart
rename to tests/lib/convert/json2_test.dart
index 1c7e4441248cb502e46b6587a0fcc634acc63565..cfb3514241e136b83f855932de5e634e348b1e71 100644
--- a/tests/json/json_test.dart
+++ b/tests/lib/convert/json2_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 json_tests;
-import "package:expect/expect.dart";
+library json2_tests;
+
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';
+
+// Moved from "tests/json/json_test.dart"
+
+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', () {
@@ -168,6 +162,6 @@ class ToJson {
* Checks that the argument can be converted to a JSON string and
* back, and produce something equivalent to the argument.
*/
-validateRoundTrip(expected) {
+void validateRoundTrip(expected) {
expect(JSON.decode(JSON.encode(expected)), equals(expected));
}
« no previous file with comments | « tests/json/json_test.dart ('k') | tests/standalone/io/status_file_parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698