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

Side by Side Diff: tests/lib/convert/json_lib_test.dart

Issue 223053004: lib/convert: removed unused import, removed redundant test (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: removed status file entry Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/lib/convert/json2_test.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library json_tests; 5 library json_tests;
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'dart:convert'; 7 import 'dart:convert';
8 8
9 main() { 9 main() {
10 test('Parse', () { 10 test('Parse', () {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 expect(JSON.encode(5), equals('5')); 74 expect(JSON.encode(5), equals('5'));
75 expect(JSON.encode(-42), equals('-42')); 75 expect(JSON.encode(-42), equals('-42'));
76 // Dart does not guarantee a formatting for doubles, 76 // Dart does not guarantee a formatting for doubles,
77 // so reparse and compare to the original. 77 // so reparse and compare to the original.
78 validateRoundTrip(3.14); 78 validateRoundTrip(3.14);
79 expect(JSON.encode(true), equals('true')); 79 expect(JSON.encode(true), equals('true'));
80 expect(JSON.encode(false), equals('false')); 80 expect(JSON.encode(false), equals('false'));
81 expect(JSON.encode(null), equals('null')); 81 expect(JSON.encode(null), equals('null'));
82 expect(JSON.encode(' hi there" bob '), equals('" hi there\\" bob "')); 82 expect(JSON.encode(' hi there" bob '), equals('" hi there\\" bob "'));
83 expect(JSON.encode('hi\\there'), equals('"hi\\\\there"')); 83 expect(JSON.encode('hi\\there'), equals('"hi\\\\there"'));
84 // TODO(devoncarew): these tests break the dartium build 84 expect(JSON.encode('hi\nthere'), equals('"hi\\nthere"'));
ricow1 2014/04/03 05:29:22 Devon: is there a bug for this that we can close o
devoncarew 2014/04/03 07:24:28 Sorry, no. This comment dates back to when I start
85 //expect(JSON.encode('hi\nthere'), equals('"hi\\nthere"')); 85 expect(JSON.encode('hi\r\nthere'), equals('"hi\\r\\nthere"'));
86 //expect(JSON.encode('hi\r\nthere'), equals('"hi\\r\\nthere"'));
87 expect(JSON.encode(''), equals('""')); 86 expect(JSON.encode(''), equals('""'));
88 87
89 // Lists. 88 // Lists.
90 expect(JSON.encode([]), equals('[]')); 89 expect(JSON.encode([]), equals('[]'));
91 expect(JSON.encode(new List(0)), equals('[]')); 90 expect(JSON.encode(new List(0)), equals('[]'));
92 expect(JSON.encode(new List(3)), equals('[null,null,null]')); 91 expect(JSON.encode(new List(3)), equals('[null,null,null]'));
93 validateRoundTrip([3, -4.5, null, true, 'hi', false]); 92 validateRoundTrip([3, -4.5, null, true, 'hi', false]);
94 expect(JSON.encode([[3], [], [null], ['hi', true]]), 93 expect(JSON.encode([[3], [], [null], ['hi', true]]),
95 equals('[[3],[],[null],["hi",true]]')); 94 equals('[[3],[],[null],["hi",true]]'));
96 95
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 var throwsJsonError = 179 var throwsJsonError =
181 throwsA(new isInstanceOf<JsonUnsupportedObjectError>()); 180 throwsA(new isInstanceOf<JsonUnsupportedObjectError>());
182 181
183 /** 182 /**
184 * Checks that the argument can be converted to a JSON string and 183 * Checks that the argument can be converted to a JSON string and
185 * back, and produce something equivalent to the argument. 184 * back, and produce something equivalent to the argument.
186 */ 185 */
187 validateRoundTrip(expected) { 186 validateRoundTrip(expected) {
188 expect(JSON.decode(JSON.encode(expected)), equals(expected)); 187 expect(JSON.decode(JSON.encode(expected)), equals(expected));
189 } 188 }
OLDNEW
« no previous file with comments | « tests/lib/convert/json2_test.dart ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698