Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(705)

Unified Diff: test/must_pub_get_test.dart

Issue 2165423002: Add support for Flutter SDK constraints. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Code review changes Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/lock_file_test.dart ('k') | test/pubspec_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/must_pub_get_test.dart
diff --git a/test/must_pub_get_test.dart b/test/must_pub_get_test.dart
index e1f71eb71351151126fe91a78ac435e41c4279b9..7703e5a6caa28496e6c27511e9990d3293fc6a4a 100644
--- a/test/must_pub_get_test.dart
+++ b/test/must_pub_get_test.dart
@@ -286,6 +286,40 @@ foo:http://example.com/
"SDK constraints. Please run \"pub get\" again.");
});
+ integration("the lock file's Flutter SDK constraint doesn't match the "
+ "current Flutter SDK", () {
+ // Avoid using a path dependency because it triggers the full validation
+ // logic. We want to be sure SDK-validation works without that logic.
+ globalPackageServer.add((builder) {
+ builder.serve("foo", "3.0.0", pubspec: {
+ "environment": {"flutter": ">=1.0.0 <2.0.0"}
+ });
+ });
+
+ d.dir('flutter', [
+ d.file('version', '1.2.3')
+ ]).create();
+
+ d.dir(appPath, [
+ d.appPubspec({"foo": "3.0.0"})
+ ]).create();
+
+ pubGet(environment: {"FLUTTER_ROOT": p.join(sandboxDir, 'flutter')});
+
+ d.dir('flutter', [
+ d.file('version', '2.4.6')
+ ]).create();
+
+ // Run pub manually here because otherwise we don't have access to
+ // sandboxDir.
+ schedulePub(
+ args: ["run", "script"],
+ environment: {"FLUTTER_ROOT": p.join(sandboxDir, 'flutter')},
+ error: "Flutter 2.4.6 is incompatible with your dependencies' SDK "
+ "constraints. Please run \"pub get\" again.",
+ exitCode: exit_codes.DATA);
+ });
+
group("a path dependency's dependency doesn't match the lockfile", () {
setUp(() {
d.dir("bar", [
@@ -394,11 +428,43 @@ foo:http://example.com/
_runsSuccessfully();
});
+
+ integration("the lock file has a Flutter SDK but Flutter is unavailable",
+ () {
+ // Avoid using a path dependency because it triggers the full validation
+ // logic. We want to be sure SDK-validation works without that logic.
+ globalPackageServer.add((builder) {
+ builder.serve("foo", "3.0.0", pubspec: {
+ "environment": {"flutter": ">=1.0.0 <2.0.0"}
+ });
+ });
+
+ d.dir('flutter', [
+ d.file('version', '1.2.3')
+ ]).create();
+
+ d.dir(appPath, [
+ d.appPubspec({"foo": "3.0.0"})
+ ]).create();
+
+ pubGet(environment: {"FLUTTER_ROOT": p.join(sandboxDir, 'flutter')});
+
+ d.dir('flutter', [
+ d.file('version', '2.4.6')
+ ]).create();
+
+ // Run pub manually here because otherwise we don't have access to
+ // sandboxDir.
+ schedulePub(args: ["run", "bin/script.dart"]);
+ });
});
}
/// Runs every command that care about the world being up-to-date, and asserts
/// that it prints [message] as part of its error.
+///
+/// If [environment] is passed, it's called to produce a map that's merged into
+/// the OS environment for the pub commands.
void _requiresPubGet(String message) {
for (var command in ["build", "serve", "run", "deps"]) {
integration("for pub $command", () {
« no previous file with comments | « test/lock_file_test.dart ('k') | test/pubspec_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698