| Index: tests/standalone/io/platform_test.dart
|
| diff --git a/tests/standalone/io/platform_test.dart b/tests/standalone/io/platform_test.dart
|
| index ce6e9776c05d769f3d0ac53ef154888a4d5a303e..1677e67ab34cd2f89987b48d31694b396accc00c 100644
|
| --- a/tests/standalone/io/platform_test.dart
|
| +++ b/tests/standalone/io/platform_test.dart
|
| @@ -3,9 +3,11 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| import "package:expect/expect.dart";
|
| +import "dart:async";
|
| import "dart:io";
|
| +import "dart:isolate";
|
|
|
| -main() {
|
| +test() {
|
| Expect.isTrue(Platform.numberOfProcessors > 0);
|
| var os = Platform.operatingSystem;
|
| Expect.isTrue(os == "android" || os == "linux" || os == "macos" ||
|
| @@ -24,3 +26,47 @@ main() {
|
| Expect.isTrue(Platform.script.replaceAll('\\', '/').
|
| endsWith('tests/standalone/io/platform_test.dart'));
|
| }
|
| +
|
| +void f() {
|
| + port.receive((msg, reply) {
|
| + if (msg == "Platform.executable") {
|
| + reply.send(Platform.executable);
|
| + }
|
| + if (msg == "Platform.script") {
|
| + reply.send(Platform.script);
|
| + }
|
| + if (msg == "new Options().executable") {
|
| + reply.send(new Options().executable);
|
| + }
|
| + if (msg == "new Options().script") {
|
| + reply.send(new Options().script);
|
| + }
|
| + if (msg == "close") {
|
| + reply.send("closed");
|
| + port.close();
|
| + }
|
| + });
|
| +}
|
| +
|
| +testIsolate() {
|
| + var port = new ReceivePort();
|
| + var sendPort = spawnFunction(f);
|
| + Future.wait([sendPort.call("Platform.executable"),
|
| + sendPort.call("Platform.script"),
|
| + sendPort.call("new Options().executable"),
|
| + sendPort.call("new Options().script")])
|
| + .then((results) {
|
| + Expect.equals(Platform.executable, results[0]);
|
| + Expect.equals(Platform.executable, results[2]);
|
| + Uri uri = Uri.parse(results[1]);
|
| + Expect.equals(uri, Uri.parse(results[3]));
|
| + Expect.equals("file", uri.scheme);
|
| + Expect.isTrue(uri.path.endsWith('tests/standalone/io/platform_test.dart'));
|
| + sendPort.call("close").then((_) => port.close());
|
| + });
|
| +}
|
| +
|
| +main() {
|
| + test();
|
| + testIsolate();
|
| +}
|
|
|