OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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:io'; | 5 import 'dart:io'; |
6 | 6 |
7 import 'package:path/path.dart' as p; | 7 import 'package:path/path.dart' as p; |
8 import 'package:scheduled_test/scheduled_process.dart'; | 8 import 'package:scheduled_test/scheduled_process.dart'; |
9 import 'package:scheduled_test/scheduled_test.dart'; | 9 import 'package:scheduled_test/scheduled_test.dart'; |
10 | 10 |
11 import '../../descriptor.dart' as d; | 11 import '../../descriptor.dart' as d; |
12 import '../../test_pub.dart'; | 12 import '../../test_pub.dart'; |
13 import 'utils.dart'; | 13 import 'utils.dart'; |
14 | 14 |
15 main() { | 15 main() { |
16 initConfig(); | 16 initConfig(); |
17 integration("the generated binstub runs a snapshotted executable", () { | 17 integration("the generated binstub runs a snapshotted executable", () { |
18 servePackages((builder) { | 18 servePackages((builder) { |
19 builder.serve("foo", "1.0.0", pubspec: { | 19 builder.serve("foo", "1.0.0", pubspec: { |
20 "executables": { | 20 "executables": { |
21 "foo-script": "script" | 21 "foo-script": "script" |
22 } | 22 } |
23 }, contents: [ | 23 }, |
24 d.dir("bin", [ | 24 contents: [ |
25 d.file("script.dart", "main(args) => print('ok \$args');") | 25 d.dir("bin", [d.file("script.dart", "main(args) => print('ok \$arg
s');")])]); |
26 ]) | |
27 ]); | |
28 }); | 26 }); |
29 | 27 |
30 schedulePub(args: ["global", "activate", "foo"]); | 28 schedulePub(args: ["global", "activate", "foo"]); |
31 | 29 |
32 var process = new ScheduledProcess.start( | 30 var process = new ScheduledProcess.start( |
33 p.join(sandboxDir, cachePath, "bin", binStubName("foo-script")), | 31 p.join(sandboxDir, cachePath, "bin", binStubName("foo-script")), |
34 ["arg1", "arg2"], | 32 ["arg1", "arg2"], |
35 environment: getEnvironment()); | 33 environment: getEnvironment()); |
36 | 34 |
37 process.stdout.expect("ok [arg1, arg2]"); | 35 process.stdout.expect("ok [arg1, arg2]"); |
38 process.shouldExit(); | 36 process.shouldExit(); |
39 }); | 37 }); |
40 | 38 |
41 integration("the generated binstub runs a non-snapshotted executable", () { | 39 integration("the generated binstub runs a non-snapshotted executable", () { |
42 d.dir("foo", [ | 40 d.dir("foo", [d.pubspec({ |
43 d.pubspec({ | |
44 "name": "foo", | 41 "name": "foo", |
45 "executables": { | 42 "executables": { |
46 "foo-script": "script" | 43 "foo-script": "script" |
47 } | 44 } |
48 }), | 45 }), |
49 d.dir("bin", [ | 46 d.dir( |
50 d.file("script.dart", "main(args) => print('ok \$args');") | 47 "bin", |
51 ]) | 48 [d.file("script.dart", "main(args) => print('ok \$args');")])]).cr
eate(); |
52 ]).create(); | |
53 | 49 |
54 schedulePub(args: ["global", "activate", "-spath", "../foo"]); | 50 schedulePub(args: ["global", "activate", "-spath", "../foo"]); |
55 | 51 |
56 var process = new ScheduledProcess.start( | 52 var process = new ScheduledProcess.start( |
57 p.join(sandboxDir, cachePath, "bin", binStubName("foo-script")), | 53 p.join(sandboxDir, cachePath, "bin", binStubName("foo-script")), |
58 ["arg1", "arg2"], | 54 ["arg1", "arg2"], |
59 environment: getEnvironment()); | 55 environment: getEnvironment()); |
60 | 56 |
61 process.stdout.expect("ok [arg1, arg2]"); | 57 process.stdout.expect("ok [arg1, arg2]"); |
62 process.shouldExit(); | 58 process.shouldExit(); |
63 }); | 59 }); |
64 } | 60 } |
OLD | NEW |