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 library pub_tests; | 5 library pub_tests; |
6 | 6 |
7 import 'package:path/path.dart' as p; | 7 import 'package:path/path.dart' as p; |
8 import 'package:scheduled_test/scheduled_test.dart'; | 8 import 'package:scheduled_test/scheduled_test.dart'; |
9 import 'package:scheduled_test/scheduled_stream.dart'; | 9 import 'package:scheduled_test/scheduled_stream.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 | 13 |
14 main() { | 14 main() { |
15 initConfig(); | 15 initConfig(); |
16 integration("creates a snapshot for an immediate dependency's executables", | 16 integration( |
| 17 "creates a snapshot for an immediate dependency's executables", |
17 () { | 18 () { |
18 servePackages((builder) { | 19 servePackages((builder) { |
19 builder.serve("foo", "5.6.7", contents: [ | 20 builder.serve( |
20 d.dir("bin", [d.file("hello.dart", "void main() => print('hello!');")]) | 21 "foo", |
21 ]); | 22 "5.6.7", |
| 23 contents: [ |
| 24 d.dir("bin", [d.file("hello.dart", "void main() => print('hello!')
;")])]); |
22 }); | 25 }); |
23 | 26 |
24 d.appDir({"foo": "5.6.7"}).create(); | 27 d.appDir({ |
| 28 "foo": "5.6.7" |
| 29 }).create(); |
25 | 30 |
26 pubGet(output: contains("Precompiled foo:hello.")); | 31 pubGet(output: contains("Precompiled foo:hello.")); |
27 | 32 |
28 d.dir(p.join(appPath, '.pub', 'bin'), [ | 33 d.dir( |
29 d.dir('foo', [d.outOfDateSnapshot('hello.dart.snapshot')]) | 34 p.join(appPath, '.pub', 'bin'), |
30 ]).create(); | 35 [d.dir('foo', [d.outOfDateSnapshot('hello.dart.snapshot')])]).create(); |
31 | 36 |
32 var process = pubRun(args: ['foo:hello']); | 37 var process = pubRun(args: ['foo:hello']); |
33 | 38 |
34 // In the real world this would just print "hello!", but since we collect | 39 // In the real world this would just print "hello!", but since we collect |
35 // all output we see the precompilation messages as well. | 40 // all output we see the precompilation messages as well. |
36 process.stdout.expect("Precompiling executables..."); | 41 process.stdout.expect("Precompiling executables..."); |
37 process.stdout.expect(consumeThrough("hello!")); | 42 process.stdout.expect(consumeThrough("hello!")); |
38 process.shouldExit(); | 43 process.shouldExit(); |
39 | 44 |
40 d.dir(p.join(appPath, '.pub', 'bin'), [ | 45 d.dir( |
41 d.file('sdk-version', '0.1.2+3'), | 46 p.join(appPath, '.pub', 'bin'), |
42 d.dir('foo', [d.matcherFile('hello.dart.snapshot', contains('hello!'))]) | 47 [ |
43 ]).create(); | 48 d.file('sdk-version', '0.1.2+3'), |
| 49 d.dir( |
| 50 'foo', |
| 51 [d.matcherFile('hello.dart.snapshot', contains('hello!'))])]).cr
eate(); |
44 }); | 52 }); |
45 } | 53 } |
OLD | NEW |