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 import 'dart:async'; | 6 import 'dart:async'; |
7 | 7 |
8 import 'package:path/path.dart' as p; | 8 import 'package:path/path.dart' as p; |
9 import 'package:scheduled_test/scheduled_process.dart'; | 9 import 'package:scheduled_test/scheduled_process.dart'; |
10 import 'package:scheduled_test/scheduled_stream.dart'; | 10 import 'package:scheduled_test/scheduled_stream.dart'; |
11 import 'package:scheduled_test/scheduled_test.dart'; | 11 import 'package:scheduled_test/scheduled_test.dart'; |
12 | 12 |
13 import '../../descriptor.dart' as d; | 13 import '../../descriptor.dart' as d; |
14 import '../../test_pub.dart'; | 14 import '../../test_pub.dart'; |
15 | 15 |
16 const _OUTDATED_BINSTUB = """ | 16 const _OUTDATED_BINSTUB = """ |
17 #!/usr/bin/env sh | 17 #!/usr/bin/env sh |
18 # This file was created by pub v0.1.2-3. | 18 # This file was created by pub v0.1.2-3. |
19 # Package: foo | 19 # Package: foo |
20 # Version: 1.0.0 | 20 # Version: 1.0.0 |
21 # Executable: foo-script | 21 # Executable: foo-script |
22 # Script: script | 22 # Script: script |
23 dart "/path/to/.pub-cache/global_packages/foo/bin/script.dart.snapshot" "\$@" | 23 dart "/path/to/.pub-cache/global_packages/foo/bin/script.dart.snapshot" "\$@" |
24 """; | 24 """; |
25 | 25 |
26 main() { | 26 main() { |
27 initConfig(); | |
28 integration("an outdated binstub is replaced", () { | 27 integration("an outdated binstub is replaced", () { |
29 servePackages((builder) { | 28 servePackages((builder) { |
30 builder.serve("foo", "1.0.0", pubspec: { | 29 builder.serve("foo", "1.0.0", pubspec: { |
31 "executables": { | 30 "executables": { |
32 "foo-script": "script" | 31 "foo-script": "script" |
33 } | 32 } |
34 }, contents: [ | 33 }, contents: [ |
35 d.dir("bin", [ | 34 d.dir("bin", [ |
36 d.file("script.dart", "main(args) => print('ok \$args');") | 35 d.file("script.dart", "main(args) => print('ok \$args');") |
37 ]) | 36 ]) |
(...skipping 11 matching lines...) Expand all Loading... |
49 schedulePub(args: ["global", "activate", "foo"]); | 48 schedulePub(args: ["global", "activate", "foo"]); |
50 | 49 |
51 d.dir(cachePath, [ | 50 d.dir(cachePath, [ |
52 d.dir('bin', [ | 51 d.dir('bin', [ |
53 // 253 is the VM's exit code upon seeing an out-of-date snapshot. | 52 // 253 is the VM's exit code upon seeing an out-of-date snapshot. |
54 d.matcherFile(binStubName('foo-script'), contains("253")) | 53 d.matcherFile(binStubName('foo-script'), contains("253")) |
55 ]) | 54 ]) |
56 ]).validate(); | 55 ]).validate(); |
57 }); | 56 }); |
58 } | 57 } |
OLD | NEW |