mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Fix JSON tests, re-enable in all cases - 2nd try
R=lrn@google.com Review URL: https://codereview.chromium.org//212813006 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34457 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
c4a107e9e6
commit
441bd85c9f
5 changed files with 13 additions and 31 deletions
|
@ -1,9 +0,0 @@
|
|||
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
||||
# 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.
|
||||
|
||||
[ $runtime == vm ]
|
||||
*: Skip
|
||||
|
||||
[ $compiler == dart2js && $runtime == none ]
|
||||
*: Fail, Pass # TODO(ahe): Triage these tests.
|
|
@ -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";
|
||||
import "dart:convert";
|
||||
import 'dart:html';
|
||||
import '../../pkg/unittest/lib/unittest.dart';
|
||||
import '../../pkg/unittest/lib/html_config.dart';
|
||||
library json2_tests;
|
||||
|
||||
main() {
|
||||
useHtmlConfiguration();
|
||||
import "dart:convert";
|
||||
|
||||
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));
|
||||
}
|
|
@ -19,7 +19,6 @@ void main() {
|
|||
TestReadStatusFile("tests/dom/dom.status");
|
||||
TestReadStatusFile("tests/html/html.status");
|
||||
TestReadStatusFile("tests/isolate/isolate.status");
|
||||
TestReadStatusFile("tests/json/json.status");
|
||||
TestReadStatusFile("tests/language/language.status");
|
||||
TestReadStatusFile("tests/standalone/standalone.status");
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ final STATUS_TUPLES = [
|
|||
["corelib", "tests/corelib", "tests/corelib/corelib.status"],
|
||||
["html", "tests/html", "tests/html/html.status"],
|
||||
["isolate", "tests/isolate", "tests/isolate/isolate.status"],
|
||||
["json", "tests/json", "tests/json/json.status"],
|
||||
["language", "tests/language", "tests/language/language.status"],
|
||||
["language", "tests/language", "tests/language/language_analyzer2.status"],
|
||||
["language","tests/language", "tests/language/language_analyzer.status"],
|
||||
|
|
|
@ -58,7 +58,6 @@ final TEST_SUITE_DIRECTORIES = [
|
|||
new Path('tests/corelib'),
|
||||
new Path('tests/html'),
|
||||
new Path('tests/isolate'),
|
||||
new Path('tests/json'),
|
||||
new Path('tests/language'),
|
||||
new Path('tests/lib'),
|
||||
new Path('tests/standalone'),
|
||||
|
|
Loading…
Reference in a new issue