Index: test/global/run/fails_if_sdk_constraint_is_unmet_test.dart |
diff --git a/test/global/run/recompiles_if_sdk_is_out_of_date_test.dart b/test/global/run/fails_if_sdk_constraint_is_unmet_test.dart |
similarity index 54% |
copy from test/global/run/recompiles_if_sdk_is_out_of_date_test.dart |
copy to test/global/run/fails_if_sdk_constraint_is_unmet_test.dart |
index c0c9bacd672860f9e3acf1d3defa1976ecc0b92c..2170513feed8a6dc850006e5bcc44fc22c9d4b5d 100644 |
--- a/test/global/run/recompiles_if_sdk_is_out_of_date_test.dart |
+++ b/test/global/run/fails_if_sdk_constraint_is_unmet_test.dart |
@@ -2,14 +2,14 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
-import 'package:scheduled_test/scheduled_stream.dart'; |
+import 'package:pub/src/exit_codes.dart' as exit_codes; |
import 'package:scheduled_test/scheduled_test.dart'; |
import '../../descriptor.dart' as d; |
import '../../test_pub.dart'; |
main() { |
- integration('recompiles a script if the SDK version is out-of-date', () { |
+ integration("fails if the current SDK doesn't match the constraint", () { |
servePackages((builder) { |
builder.serve("foo", "1.0.0", contents: [ |
d.dir("bin", [ |
@@ -20,29 +20,26 @@ main() { |
schedulePub(args: ["global", "activate", "foo"]); |
- d.dir(cachePath, [ |
- d.dir('global_packages', [ |
- d.dir('foo', [ |
- d.dir('bin', [d.outOfDateSnapshot('script.dart.snapshot')]) |
- ]) |
+ d.hostedCache([ |
+ d.dir("foo-1.0.0", [ |
+ d.libPubspec("foo", "1.0.0", sdk: "0.5.6") |
]) |
]).create(); |
- var pub = pubRun(global: true, args: ["foo:script"]); |
- // In the real world this would just print "hello!", but since we collect |
- // all output we see the precompilation messages as well. |
- pub.stdout.expect("Precompiling executables..."); |
- pub.stdout.expect(consumeThrough("ok")); |
- pub.shouldExit(); |
- |
+ // Make the snapshot out-of-date, too, so that we load the pubspec with the |
+ // SDK constraint in the first place. In practice, the VM snapshot |
+ // invalidation logic is based on the version anyway, so this is a safe |
+ // assumption. |
d.dir(cachePath, [ |
d.dir('global_packages', [ |
d.dir('foo', [ |
- d.dir('bin', [ |
- d.matcherFile('script.dart.snapshot', contains('ok')) |
- ]) |
+ d.dir('bin', [d.outOfDateSnapshot('script.dart.snapshot')]) |
]) |
]) |
- ]).validate(); |
+ ]).create(); |
+ |
+ schedulePub(args: ["global", "run", "foo:script"], |
+ error: contains("foo 1.0.0 doesn't support Dart 0.1.2+3."), |
+ exitCode: exit_codes.DATA); |
}); |
} |