OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2016, 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.md file. | |
4 | |
5 library fasta.test.compile_platform_test; | |
6 | |
7 import 'dart:io'; | |
8 | |
9 import 'package:async_helper/async_helper.dart'; | |
10 | |
11 import 'package:expect/expect.dart'; | |
12 | |
13 import '../../tool/_fasta/compile_platform.dart' show compilePlatform; | |
14 | |
15 main(List<String> arguments) async { | |
16 await asyncTest(() async { | |
17 await withTemporyDirectory("compile_platform_test_", (Uri tmp) async { | |
18 String patchedSdk = Uri.base | |
19 .resolveUri(new Uri.file(Platform.resolvedExecutable)) | |
20 .resolve("patched_sdk") | |
21 .toFilePath(); | |
22 // This first invocation should succeed. | |
23 await compilePlatform(<String>[ | |
Siggi Cherem (dart-lang)
2017/08/24 19:27:02
Alternatively, should we use the public APIs here
ahe
2017/08/25 08:45:51
I think it's a great idea to rewrite tool/_fasta/c
Siggi Cherem (dart-lang)
2017/08/25 14:41:48
OK - I misunderstood, I thought the goal was to ha
| |
24 "-v", | |
25 patchedSdk, | |
26 tmp.resolve("platform.dill").toFilePath(), | |
27 tmp.resolve("platform-outline.dill").toFilePath(), | |
28 ]); | |
29 print("Successfully compiled $patchedSdk.\n\n"); | |
30 | |
31 try { | |
32 // This invocation is expected to throw an exception for now. Patching | |
33 // isn't fully implemented yet. | |
34 await compilePlatform(<String>[ | |
35 "-v", | |
36 "sdk/", | |
Siggi Cherem (dart-lang)
2017/08/24 19:27:02
it might be worth checking first that this folder
ahe
2017/08/25 08:45:51
That will lead to a different error and this test
| |
37 tmp.resolve("platform.dill").toFilePath(), | |
38 tmp.resolve("platform-outline.dill").toFilePath(), | |
39 ]); | |
40 } on String catch (e) { | |
41 Expect.isTrue( | |
42 e.startsWith("A member with disambiguated name '_withType' ")); | |
43 print("Failed as expected: $e"); | |
44 return; | |
45 } | |
46 Expect.fail("Test didn't throw expected exception."); | |
47 }); | |
48 }); | |
49 } | |
50 | |
51 withTemporyDirectory(String prefix, Future f(Uri tmp)) async { | |
52 Directory tmp = await Directory.systemTemp.createTemp(prefix); | |
53 try { | |
54 await f(tmp.uri); | |
55 } finally { | |
56 await tmp.delete(recursive: true); | |
Siggi Cherem (dart-lang)
2017/08/24 19:27:02
if we switch to use the public API, we should also
ahe
2017/08/25 08:45:51
Yes, but that wouldn't test the tool. Perhaps we s
Siggi Cherem (dart-lang)
2017/08/25 14:41:48
yes :)
| |
57 } | |
58 } | |
OLD | NEW |