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

Unified Diff: tests/isolate/src/SerializationTest.dart

Issue 10247004: test rename overhaul: step 6 - isolate tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: tests/isolate/src/SerializationTest.dart
diff --git a/tests/isolate/src/SerializationTest.dart b/tests/isolate/src/SerializationTest.dart
deleted file mode 100644
index 61062fa6e7016ed575fa43c836bc90a9040de3bb..0000000000000000000000000000000000000000
--- a/tests/isolate/src/SerializationTest.dart
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2011, 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.
-
-// Dart test program for testing serialization of messages without spawning
-// isolates.
-
-// ---------------------------------------------------------------------------
-// Serialization test.
-// ---------------------------------------------------------------------------
-#library('SerializationTest');
-#import('dart:isolate');
-
-main() {
- // TODO(sigmund): fix once we can disable privacy for testing (bug #1882)
- testAllTypes(TestingOnly.copy);
- testAllTypes(TestingOnly.serialize);
-}
-
-void testAllTypes(Function f) {
- copyAndVerify(0, f);
- copyAndVerify(499, f);
- copyAndVerify(true, f);
- copyAndVerify(false, f);
- copyAndVerify("", f);
- copyAndVerify("foo", f);
- copyAndVerify([], f);
- copyAndVerify([1, 2], f);
- copyAndVerify([[]], f);
- copyAndVerify([1, []], f);
- copyAndVerify({}, f);
- copyAndVerify({ 'a': 3 }, f);
- copyAndVerify({ 'a': 3, 'b': 5, 'c': 8 }, f);
- copyAndVerify({ 'a': [1, 2] }, f);
- copyAndVerify({ 'b': { 'c' : 99 } }, f);
- copyAndVerify([ { 'a': 499 }, { 'b': 42 } ], f);
-
- var port = new ReceivePort();
- Expect.throws(() => f(port));
- port.close();
-
- var a = [ 1, 3, 5 ];
- var b = { 'b': 49 };
- var c = [ a, b, a, b, a ];
- var copied = f(c);
- verify(c, copied);
- Expect.isFalse(c === copied);
- Expect.isTrue(copied[0] === copied[2]);
- Expect.isTrue(copied[0] === copied[4]);
- Expect.isTrue(copied[1] === copied[3]);
-}
-
-void copyAndVerify(o, Function f) {
- var copy = f(o);
- verify(o, copy);
-}
-
-void verify(o, copy) {
- if ((o is bool) || (o is num) || (o is String)) {
- Expect.equals(o, copy);
- } else if (o is List) {
- Expect.isTrue(copy is List);
- Expect.equals(o.length, copy.length);
- for (int i = 0; i < o.length; i++) {
- verify(o[i], copy[i]);
- }
- } else if (o is Map) {
- Expect.isTrue(copy is Map);
- Expect.equals(o.length, copy.length);
- o.forEach((key, value) {
- Expect.isTrue(copy.containsKey(key));
- verify(value, copy[key]);
- });
- } else {
- Expect.fail("Unexpected object encountered");
- }
-}

Powered by Google App Engine
This is Rietveld 408576698