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

Unified Diff: tests/lib/codec/codec2_test.dart

Issue 19941002: Remove dart:codec and move classes into dart:convert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 5 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/lib/codec/codec1_test.dart ('k') | tests/lib/convert/codec1_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/codec/codec2_test.dart
diff --git a/tests/lib/codec/codec2_test.dart b/tests/lib/codec/codec2_test.dart
deleted file mode 100644
index 606d454cfd00aeefc13609376cc8f44de582952b..0000000000000000000000000000000000000000
--- a/tests/lib/codec/codec2_test.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2013, 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.
-
-import 'dart:codec';
-
-import 'package:expect/expect.dart';
-
-main() {
- final RAW = '["122ç",50,50,231]';
- final ENCODED = const [91, 34, 49, 50, 50, 195, 167, 34, 44,
- 53, 48, 44, 53, 48, 44, 50, 51, 49, 93];
- Expect.listEquals(ENCODED, UTF8.encode(RAW));
- Expect.equals(RAW, UTF8.decode(ENCODED));
-
- Expect.listEquals([], UTF8.encode(""));
- Expect.equals("", UTF8.decode([]));
-
- final JSON_ENCODED = RAW;
- Expect.equals(JSON_ENCODED, JSON.encode(["122ç", 50, 50, 231]));
- Expect.listEquals(["122ç", 50, 50, 231], JSON.decode(JSON_ENCODED));
-
- // Test that the reviver is passed to the decoder.
- var decoded = JSON.decode('{"p": 5}', reviver: (k, v) {
- if (k == "") return v;
- return v * 2;
- });
- Expect.equals(10, decoded["p"]);
- var jsonWithReviver = new JsonCodec.withReviver((k, v) {
- if (k == "") return v;
- return v * 2;
- });
- decoded = jsonWithReviver.decode('{"p": 5}');
- Expect.equals(10, decoded["p"]);
-
- // Test example from comments.
- final JSON_TO_BYTES = JSON.fuse(UTF8);
- List<int> bytes = JSON_TO_BYTES.encode(["json-object"]);
- decoded = JSON_TO_BYTES.decode(bytes);
- Expect.isTrue(decoded is List);
- Expect.equals("json-object", decoded[0]);
-}
« no previous file with comments | « tests/lib/codec/codec1_test.dart ('k') | tests/lib/convert/codec1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698