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

Unified Diff: tests/isolate/stream_mangling_test.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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/isolate/multiple_timer_test.dart ('k') | tests/isolate/timer_cancel1_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/stream_mangling_test.dart
diff --git a/tests/isolate/stream_mangling_test.dart b/tests/isolate/stream_mangling_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..fbc56f6d5399e541d82626680430a2e554d7c4e0
--- /dev/null
+++ b/tests/isolate/stream_mangling_test.dart
@@ -0,0 +1,100 @@
+// 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.
+
+import 'dart:isolate';
+import '../../pkg/unittest/lib/unittest.dart';
+
+main() {
+ test("Self referencing arrays serialize correctly", () {
+ var messageBox = new MessageBox();
+ var stream = messageBox.stream;
+ var sink = messageBox.sink;
+ var nested = [];
+ nested.add(nested);
+ Expect.identical(nested, nested[0]);
+ stream.listen(expectAsync1((data) {
+ Expect.isFalse(identical(nested, data));
+ Expect.isTrue(data is List);
+ Expect.equals(1, data.length);
+ Expect.identical(data, data[0]);
+ stream.close();
+ }));
+ sink.add(nested);
+ });
+
+ test("Self referencing arrays serialize correctly 2", () {
+ var messageBox = new MessageBox();
+ var stream = messageBox.stream;
+ var sink = messageBox.sink;
+ var nested = [0, 1];
+ nested.add(nested);
+ nested.add(3);
+ nested.add(4);
+ Expect.identical(nested, nested[2]);
+ stream.listen(expectAsync1((data) {
+ Expect.isFalse(identical(nested, data));
+ Expect.isTrue(data is List);
+ Expect.equals(5, data.length);
+ Expect.identical(data, data[2]);
+ Expect.equals(0, data[0]);
+ Expect.equals(1, data[1]);
+ Expect.equals(3, data[3]);
+ Expect.equals(4, data[4]);
+ stream.close();
+ }));
+ sink.add(nested);
+ });
+
+ test("Self referencing arrays serialize correctly 3", () {
+ var messageBox = new MessageBox();
+ var stream = messageBox.stream;
+ var sink = messageBox.sink;
+ var nested = [[[[[0, 1]]]]];
+ nested.add(nested);
+ nested[0][0][0][0].add(nested);
+ nested.add(3);
+ nested.add(4);
+ Expect.identical(nested, nested[0][0][0][0][2]);
+ stream.listen(expectAsync1((data) {
+ Expect.isFalse(identical(nested, data));
+ Expect.isTrue(data is List);
+ Expect.equals(4, data.length);
+ Expect.equals(1, data[0].length);
+ Expect.equals(1, data[0][0].length);
+ Expect.equals(1, data[0][0][0].length);
+ Expect.equals(3, data[0][0][0][0].length);
+ Expect.identical(data, data[0][0][0][0][2]);
+ Expect.identical(data, data[1]);
+ Expect.equals(3, data[2]);
+ Expect.equals(4, data[3]);
+ stream.close();
+ }));
+ sink.add(nested);
+ });
+
+ test("Self referencing maps serialize correctly", () {
+ var messageBox = new MessageBox();
+ var stream = messageBox.stream;
+ var sink = messageBox.sink;
+ var nested = {};
+ nested["foo"] = nested;
+ Expect.identical(nested, nested["foo"]);
+ stream.listen(expectAsync1((data) {
+ Expect.isFalse(identical(nested, data));
+ Expect.isTrue(data is Map);
+ Expect.equals(1, data.length);
+ Expect.identical(data, data["foo"]);
+ stream.close();
+ }));
+ sink.add(nested);
+ });
+
+ test("Sending of IsolateSinks", () {
+ // TODO(floitsch): add test.
+ });
+
+ test("Sending of IsolateSinks in complicated structures", () {
+ // TODO(floitsch): add test.
+ });
+}
« no previous file with comments | « tests/isolate/multiple_timer_test.dart ('k') | tests/isolate/timer_cancel1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698