OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import "dart:async"; | 5 import "dart:async"; |
6 import "dart:io"; | 6 import "dart:io"; |
7 import "dart:convert" show JSON; | 7 import "dart:convert" show JSON; |
8 import "package:path/path.dart" as p; | 8 import "package:path/path.dart" as p; |
9 import "package:async_helper/async_helper.dart"; | 9 import "package:async_helper/async_helper.dart"; |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 List<Configuration> configurations = []; | 21 List<Configuration> configurations = []; |
22 /// Collection of failing tests and their failure messages. | 22 /// Collection of failing tests and their failure messages. |
23 /// | 23 /// |
24 /// Each test may fail in more than one way. | 24 /// Each test may fail in more than one way. |
25 var failingTests = <String, List<String>>{}; | 25 var failingTests = <String, List<String>>{}; |
26 | 26 |
27 main() async { | 27 main() async { |
28 asyncStart(); | 28 asyncStart(); |
29 await setUp(); | 29 await setUp(); |
30 | 30 |
31 await runTests(); /// 01: ok | 31 await runTests(); // /// 01: ok |
32 await runTests([spawn]); /// 02: ok | 32 await runTests([spawn]); // /// 02: ok |
33 await runTests([spawn, spawn]); /// 03: ok | 33 await runTests([spawn, spawn]); // /// 03: ok |
34 await runTests([spawnUriInherit]); /// 04: ok | 34 await runTests([spawnUriInherit]); // /// 04: ok |
35 await runTests([spawnUriInherit, spawn]); /// 05: ok | 35 await runTests([spawnUriInherit, spawn]); // /// 05: ok |
36 await runTests([spawn, spawnUriInherit]); /// 06: ok | 36 await runTests([spawn, spawnUriInherit]); // /// 06: ok |
37 | 37 |
38 // Test that spawning a new VM with file paths instead of URIs as arguments | 38 // Test that spawning a new VM with file paths instead of URIs as arguments |
39 // gives the same URIs in the internal values. | 39 // gives the same URIs in the internal values. |
40 await runTests([asPath]); /// 07: ok | 40 await runTests([asPath]); // /// 07: ok |
41 | 41 |
42 // Test that spawnUri can reproduce the behavior of VM command line parameters | 42 // Test that spawnUri can reproduce the behavior of VM command line parameters |
43 // exactly. | 43 // exactly. |
44 // (Don't run all configuration combinations in the same test, so | 44 // (Don't run all configuration combinations in the same test, so |
45 // unroll the configurations into multiple groups and run each group | 45 // unroll the configurations into multiple groups and run each group |
46 // as its own multitest. | 46 // as its own multitest. |
47 { | 47 { |
48 var groupCount = 8; | 48 var groupCount = 8; |
49 var groups = new List.generate(8, (_)=>[]); | 49 var groups = new List.generate(8, (_)=>[]); |
50 for (int i = 0; i < configurations.length; i++) { | 50 for (int i = 0; i < configurations.length; i++) { |
51 groups[i % groupCount].add(configurations[i]); | 51 groups[i % groupCount].add(configurations[i]); |
52 } | 52 } |
53 var group = -1; | 53 var group = -1; |
54 group = 0; /// 10: ok | 54 group = 0; // /// 10: ok |
55 group = 1; /// 11: ok | 55 group = 1; // /// 11: ok |
56 group = 2; /// 12: ok | 56 group = 2; // /// 12: ok |
57 group = 3; /// 13: ok | 57 group = 3; // /// 13: ok |
58 group = 4; /// 14: ok | 58 group = 4; // /// 14: ok |
59 group = 5; /// 15: ok | 59 group = 5; // /// 15: ok |
60 group = 6; /// 16: ok | 60 group = 6; // /// 16: ok |
61 group = 7; /// 17: ok | 61 group = 7; // /// 17: ok |
62 if (group >= 0) { | 62 if (group >= 0) { |
63 for (var other in groups[group]) { | 63 for (var other in groups[group]) { |
64 await runTests([spawnUriOther(other)]); | 64 await runTests([spawnUriOther(other)]); |
65 } | 65 } |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 await tearDown(); | 70 await tearDown(); |
71 | 71 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 { | 442 { |
443 // Specified package config that doesn't exist. | 443 // Specified package config that doesn't exist. |
444 // Ignores existing .packages file and packages/ dir. | 444 // Ignores existing .packages file and packages/ dir. |
445 addScheme("explicit config not there", | 445 addScheme("explicit config not there", |
446 "%$scheme/", | 446 "%$scheme/", |
447 files: {".packages": "foo:packages/foo/", | 447 files: {".packages": "foo:packages/foo/", |
448 "packages": fooPackage}, | 448 "packages": fooPackage}, |
449 config: "%$scheme/.notthere", | 449 config: "%$scheme/.notthere", |
450 expect: { | 450 expect: { |
451 "pconf": "%$scheme/.notthere", | 451 "pconf": "%$scheme/.notthere", |
452 "iconf": null, // <- Only there if actually loaded (unspecified). | 452 "iconf": null, // <- Only there if actually loaded (unspecified). |
453 "foo/": null, | 453 "foo/": null, |
454 "foo/bar": null, | 454 "foo/bar": null, |
455 "foo.x": null, | 455 "foo.x": null, |
456 }); | 456 }); |
457 } | 457 } |
458 | 458 |
459 { | 459 { |
460 // Specified package root with no trailing slash. | 460 // Specified package root with no trailing slash. |
461 // The Platform.packageRoot and Isolate.packageRoot has a trailing slash. | 461 // The Platform.packageRoot and Isolate.packageRoot has a trailing slash. |
462 var files = {".packages": "foo:packages/foo/", | 462 var files = {".packages": "foo:packages/foo/", |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 void insertFileAt(Map file, Map http, | 977 void insertFileAt(Map file, Map http, |
978 String path, String name, String content) { | 978 String path, String name, String content) { |
979 var parts = path.split('/').toList(); | 979 var parts = path.split('/').toList(); |
980 var dir = (parts[0] == "%file") ? file : http; | 980 var dir = (parts[0] == "%file") ? file : http; |
981 for (var i = 1; i < parts.length - 1; i++) { | 981 for (var i = 1; i < parts.length - 1; i++) { |
982 var entry = parts[i]; | 982 var entry = parts[i]; |
983 dir = dir[entry] ?? (dir[entry] = {}); | 983 dir = dir[entry] ?? (dir[entry] = {}); |
984 } | 984 } |
985 dir[name] = content; | 985 dir[name] = content; |
986 } | 986 } |
OLD | NEW |