| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 library fasta.test.compile_platform_test; | 5 library fasta.test.compile_platform_test; |
| 6 | 6 |
| 7 import 'dart:async'; |
| 7 import 'dart:io'; | 8 import 'dart:io'; |
| 8 | 9 |
| 9 import 'package:async_helper/async_helper.dart'; | 10 import 'package:async_helper/async_helper.dart'; |
| 10 | 11 |
| 11 import 'package:expect/expect.dart'; | 12 import 'package:expect/expect.dart'; |
| 12 | 13 |
| 13 import '../../tool/_fasta/compile_platform.dart' show compilePlatform; | 14 import '../../tool/_fasta/compile_platform.dart' show compilePlatform; |
| 14 | 15 |
| 15 main(List<String> arguments) async { | 16 main(List<String> arguments) async { |
| 16 await asyncTest(() async { | 17 await asyncTest(() async { |
| 17 await withTemporyDirectory("compile_platform_test_", (Uri tmp) async { | 18 await withTemporaryDirectory("compile_platform_test_", (Uri tmp) async { |
| 18 String patchedSdk = Uri.base | 19 String patchedSdk = Uri.base |
| 19 .resolveUri(new Uri.file(Platform.resolvedExecutable)) | 20 .resolveUri(new Uri.file(Platform.resolvedExecutable)) |
| 20 .resolve("patched_sdk") | 21 .resolve("patched_sdk") |
| 21 .toFilePath(); | 22 .toFilePath(); |
| 22 // This first invocation should succeed. | 23 // This first invocation should succeed. |
| 23 await compilePlatform(<String>[ | 24 await compilePlatform(<String>[ |
| 24 "-v", | 25 "-v", |
| 25 patchedSdk, | 26 patchedSdk, |
| 26 tmp.resolve("platform.dill").toFilePath(), | 27 tmp.resolve("platform.dill").toFilePath(), |
| 27 tmp.resolve("platform-outline.dill").toFilePath(), | 28 tmp.resolve("platform-outline.dill").toFilePath(), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 44 Expect.isTrue( | 45 Expect.isTrue( |
| 45 e.startsWith("A member with disambiguated name '_withType' ")); | 46 e.startsWith("A member with disambiguated name '_withType' ")); |
| 46 print("Failed as expected: $e"); | 47 print("Failed as expected: $e"); |
| 47 return; | 48 return; |
| 48 } | 49 } |
| 49 Expect.fail("Test didn't throw expected exception."); | 50 Expect.fail("Test didn't throw expected exception."); |
| 50 }); | 51 }); |
| 51 }); | 52 }); |
| 52 } | 53 } |
| 53 | 54 |
| 54 withTemporyDirectory(String prefix, Future f(Uri tmp)) async { | 55 withTemporaryDirectory(String prefix, Future f(Uri tmp)) async { |
| 55 Directory tmp = await Directory.systemTemp.createTemp(prefix); | 56 Directory tmp = await Directory.systemTemp.createTemp(prefix); |
| 56 try { | 57 try { |
| 57 await f(tmp.uri); | 58 await f(tmp.uri); |
| 58 } finally { | 59 } finally { |
| 59 await tmp.delete(recursive: true); | 60 await tmp.delete(recursive: true); |
| 60 } | 61 } |
| 61 } | 62 } |
| OLD | NEW |