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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/isolate/multiple_timer_test.dart ('k') | tests/isolate/timer_cancel1_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
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.
4
5 import 'dart:isolate';
6 import '../../pkg/unittest/lib/unittest.dart';
7
8 main() {
9 test("Self referencing arrays serialize correctly", () {
10 var messageBox = new MessageBox();
11 var stream = messageBox.stream;
12 var sink = messageBox.sink;
13 var nested = [];
14 nested.add(nested);
15 Expect.identical(nested, nested[0]);
16 stream.listen(expectAsync1((data) {
17 Expect.isFalse(identical(nested, data));
18 Expect.isTrue(data is List);
19 Expect.equals(1, data.length);
20 Expect.identical(data, data[0]);
21 stream.close();
22 }));
23 sink.add(nested);
24 });
25
26 test("Self referencing arrays serialize correctly 2", () {
27 var messageBox = new MessageBox();
28 var stream = messageBox.stream;
29 var sink = messageBox.sink;
30 var nested = [0, 1];
31 nested.add(nested);
32 nested.add(3);
33 nested.add(4);
34 Expect.identical(nested, nested[2]);
35 stream.listen(expectAsync1((data) {
36 Expect.isFalse(identical(nested, data));
37 Expect.isTrue(data is List);
38 Expect.equals(5, data.length);
39 Expect.identical(data, data[2]);
40 Expect.equals(0, data[0]);
41 Expect.equals(1, data[1]);
42 Expect.equals(3, data[3]);
43 Expect.equals(4, data[4]);
44 stream.close();
45 }));
46 sink.add(nested);
47 });
48
49 test("Self referencing arrays serialize correctly 3", () {
50 var messageBox = new MessageBox();
51 var stream = messageBox.stream;
52 var sink = messageBox.sink;
53 var nested = [[[[[0, 1]]]]];
54 nested.add(nested);
55 nested[0][0][0][0].add(nested);
56 nested.add(3);
57 nested.add(4);
58 Expect.identical(nested, nested[0][0][0][0][2]);
59 stream.listen(expectAsync1((data) {
60 Expect.isFalse(identical(nested, data));
61 Expect.isTrue(data is List);
62 Expect.equals(4, data.length);
63 Expect.equals(1, data[0].length);
64 Expect.equals(1, data[0][0].length);
65 Expect.equals(1, data[0][0][0].length);
66 Expect.equals(3, data[0][0][0][0].length);
67 Expect.identical(data, data[0][0][0][0][2]);
68 Expect.identical(data, data[1]);
69 Expect.equals(3, data[2]);
70 Expect.equals(4, data[3]);
71 stream.close();
72 }));
73 sink.add(nested);
74 });
75
76 test("Self referencing maps serialize correctly", () {
77 var messageBox = new MessageBox();
78 var stream = messageBox.stream;
79 var sink = messageBox.sink;
80 var nested = {};
81 nested["foo"] = nested;
82 Expect.identical(nested, nested["foo"]);
83 stream.listen(expectAsync1((data) {
84 Expect.isFalse(identical(nested, data));
85 Expect.isTrue(data is Map);
86 Expect.equals(1, data.length);
87 Expect.identical(data, data["foo"]);
88 stream.close();
89 }));
90 sink.add(nested);
91 });
92
93 test("Sending of IsolateSinks", () {
94 // TODO(floitsch): add test.
95 });
96
97 test("Sending of IsolateSinks in complicated structures", () {
98 // TODO(floitsch): add test.
99 });
100 }
OLDNEW
« 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