OLD | NEW |
(Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'package:path/path.dart' as p; |
| 6 import 'package:scheduled_test/scheduled_test.dart'; |
| 7 |
| 8 import '../descriptor.dart' as d; |
| 9 import '../test_pub.dart'; |
| 10 |
| 11 main() { |
| 12 group("with --no-precompile,", () { |
| 13 integration("doesn't create a new snapshot", () { |
| 14 servePackages((builder) { |
| 15 builder.serve("foo", "1.2.3", contents: [ |
| 16 d.dir("bin", [ |
| 17 d.file("hello.dart", "void main() => print('hello!');"), |
| 18 d.file("goodbye.dart", "void main() => print('goodbye!');"), |
| 19 d.file("shell.sh", "echo shell"), |
| 20 d.dir("subdir", [ |
| 21 d.file("sub.dart", "void main() => print('sub!');") |
| 22 ]) |
| 23 ]) |
| 24 ]); |
| 25 }); |
| 26 |
| 27 d.appDir({"foo": "1.2.3"}).create(); |
| 28 |
| 29 pubGet(args: ["--no-precompile"], output: isNot(contains("Precompiled"))); |
| 30 |
| 31 d.nothing(p.join(appPath, '.pub')).validate(); |
| 32 |
| 33 var process = pubRun(args: ['foo:hello']); |
| 34 process.stdout.expect("hello!"); |
| 35 process.shouldExit(); |
| 36 |
| 37 process = pubRun(args: ['foo:goodbye']); |
| 38 process.stdout.expect("goodbye!"); |
| 39 process.shouldExit(); |
| 40 }); |
| 41 |
| 42 integration("deletes a snapshot when its package is upgraded", () { |
| 43 servePackages((builder) { |
| 44 builder.serve("foo", "1.2.3", contents: [ |
| 45 d.dir("bin", [ |
| 46 d.file("hello.dart", "void main() => print('hello!');") |
| 47 ]) |
| 48 ]); |
| 49 }); |
| 50 |
| 51 d.appDir({"foo": "any"}).create(); |
| 52 |
| 53 pubGet(output: contains("Precompiled foo:hello.")); |
| 54 |
| 55 d.dir(p.join(appPath, '.pub', 'bin', 'foo'), [ |
| 56 d.matcherFile('hello.dart.snapshot', contains('hello!')) |
| 57 ]).validate(); |
| 58 |
| 59 globalPackageServer.add((builder) { |
| 60 builder.serve("foo", "1.2.4", contents: [ |
| 61 d.dir("bin", [ |
| 62 d.file("hello.dart", "void main() => print('hello 2!');") |
| 63 ]) |
| 64 ]); |
| 65 }); |
| 66 |
| 67 pubUpgrade( |
| 68 args: ["--no-precompile"], |
| 69 output: isNot(contains("Precompiled"))); |
| 70 |
| 71 d.nothing(p.join(appPath, '.pub', 'bin', 'foo')).validate(); |
| 72 |
| 73 var process = pubRun(args: ['foo:hello']); |
| 74 process.stdout.expect("hello 2!"); |
| 75 process.shouldExit(); |
| 76 }); |
| 77 |
| 78 integration("doesn't delete a snapshot when no dependencies of a package " |
| 79 "have changed", () { |
| 80 servePackages((builder) { |
| 81 builder.serve("foo", "1.2.3", deps: {"bar": "any"}, contents: [ |
| 82 d.dir("bin", [ |
| 83 d.file("hello.dart", "void main() => print('hello!');") |
| 84 ]) |
| 85 ]); |
| 86 builder.serve("bar", "1.2.3"); |
| 87 }); |
| 88 |
| 89 d.appDir({"foo": "1.2.3"}).create(); |
| 90 |
| 91 pubGet(output: contains("Precompiled foo:hello.")); |
| 92 |
| 93 pubUpgrade( |
| 94 args: ["--no-precompile"], |
| 95 output: isNot(contains("Precompiled"))); |
| 96 |
| 97 d.dir(p.join(appPath, '.pub', 'bin'), [ |
| 98 d.file('sdk-version', '0.1.2+3\n'), |
| 99 d.dir('foo', [d.matcherFile('hello.dart.snapshot', contains('hello!'))]) |
| 100 ]).validate(); |
| 101 }); |
| 102 }); |
| 103 } |
OLD | NEW |