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