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

Side by Side Diff: tests/isolate/stream_mangling_test.dart

Issue 27215002: Very simple version of Isolates. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 1 month 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/stacktrace_message_test.dart ('k') | tests/isolate/unresolved_ports_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 library stream_mangling_test;
6
7 import "package:expect/expect.dart";
8 import 'dart:isolate';
9 import '../../pkg/unittest/lib/unittest.dart';
10
11 main() {
12 test("Self referencing arrays serialize correctly", () {
13 var messageBox = new MessageBox();
14 var stream = messageBox.stream;
15 var sink = messageBox.sink;
16 var nested = [];
17 nested.add(nested);
18 Expect.identical(nested, nested[0]);
19 stream.listen(expectAsync1((data) {
20 Expect.isFalse(identical(nested, data));
21 Expect.isTrue(data is List);
22 Expect.equals(1, data.length);
23 Expect.identical(data, data[0]);
24 stream.close();
25 }));
26 sink.add(nested);
27 });
28
29 test("Self referencing arrays serialize correctly 2", () {
30 var messageBox = new MessageBox();
31 var stream = messageBox.stream;
32 var sink = messageBox.sink;
33 var nested = [0, 1];
34 nested.add(nested);
35 nested.add(3);
36 nested.add(4);
37 Expect.identical(nested, nested[2]);
38 stream.listen(expectAsync1((data) {
39 Expect.isFalse(identical(nested, data));
40 Expect.isTrue(data is List);
41 Expect.equals(5, data.length);
42 Expect.identical(data, data[2]);
43 Expect.equals(0, data[0]);
44 Expect.equals(1, data[1]);
45 Expect.equals(3, data[3]);
46 Expect.equals(4, data[4]);
47 stream.close();
48 }));
49 sink.add(nested);
50 });
51
52 test("Self referencing arrays serialize correctly 3", () {
53 var messageBox = new MessageBox();
54 var stream = messageBox.stream;
55 var sink = messageBox.sink;
56 var nested = [[[[[0, 1]]]]];
57 nested.add(nested);
58 nested[0][0][0][0].add(nested);
59 nested.add(3);
60 nested.add(4);
61 Expect.identical(nested, nested[0][0][0][0][2]);
62 stream.listen(expectAsync1((data) {
63 Expect.isFalse(identical(nested, data));
64 Expect.isTrue(data is List);
65 Expect.equals(4, data.length);
66 Expect.equals(1, data[0].length);
67 Expect.equals(1, data[0][0].length);
68 Expect.equals(1, data[0][0][0].length);
69 Expect.equals(3, data[0][0][0][0].length);
70 Expect.identical(data, data[0][0][0][0][2]);
71 Expect.identical(data, data[1]);
72 Expect.equals(3, data[2]);
73 Expect.equals(4, data[3]);
74 stream.close();
75 }));
76 sink.add(nested);
77 });
78
79 test("Self referencing maps serialize correctly", () {
80 var messageBox = new MessageBox();
81 var stream = messageBox.stream;
82 var sink = messageBox.sink;
83 var nested = {};
84 nested["foo"] = nested;
85 Expect.identical(nested, nested["foo"]);
86 stream.listen(expectAsync1((data) {
87 Expect.isFalse(identical(nested, data));
88 Expect.isTrue(data is Map);
89 Expect.equals(1, data.length);
90 Expect.identical(data, data["foo"]);
91 stream.close();
92 }));
93 sink.add(nested);
94 });
95
96 test("Sending of IsolateSinks", () {
97 // TODO(floitsch): add test.
98 });
99
100 test("Sending of IsolateSinks in complicated structures", () {
101 // TODO(floitsch): add test.
102 });
103 }
OLDNEW
« no previous file with comments | « tests/isolate/stacktrace_message_test.dart ('k') | tests/isolate/unresolved_ports_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698