Index: tests/isolate/checked_test.dart |
diff --git a/tests/isolate/checked_test.dart b/tests/isolate/checked_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..87f6a036ddc1a854216dcdc6be36d3f1aa1922c8 |
--- /dev/null |
+++ b/tests/isolate/checked_test.dart |
@@ -0,0 +1,48 @@ |
+// Copyright (c) 2014, 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 "dart:async"; |
+import "package:expect/expect.dart"; |
+import "package:async_helper/async_helper.dart"; |
+ |
+void main([args, message]) { |
+ if (message != null) return isolateMain(message); |
+ |
+ bool isChecked = false; |
+ assert((isChecked = true)); |
+ if (isChecked) return; // Skip this test in checked mode. |
+ |
+ var responses = {}; |
+ var port = new RawReceivePort(); |
+ port.handler = (pair) { |
+ responses[pair[0]] = pair[1]; |
+ if (responses.length == 3) { |
+ port.close(); |
+ Expect.isTrue(responses[true], "true @ $isChecked"); |
+ Expect.isTrue(responses[false], "false @ $isChecked"); |
+ Expect.isTrue(responses[null], "null @ $isChecked"); |
+ } |
+ }; |
+ test(checked) { |
+ Isolate.spawnUri(Uri.parse("checked_test.dart"), [], |
+ [checked, isChecked, port.sendPort], |
+ checked: checked); |
+ } |
+ test(true); |
+ test(false); |
+ test(null); |
+} |
+ |
+ |
+void isolateMain(args) { |
+ var checkedFlag = args[0]; |
+ var parentIsChecked = args[1]; |
+ var responsePort = args[2]; |
+ bool isChecked = false; |
+ assert((isChecked = true)); |
+ bool expected = checkedFlag; |
+ if (checkedFlag == null) expected = parentIsChecked; |
+ responsePort.send([checkedFlag, expected == isChecked]); |
+} |