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

Unified Diff: test/pubspec_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/must_pub_get_test.dart ('k') | test/version_solver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/pubspec_test.dart
diff --git a/test/pubspec_test.dart b/test/pubspec_test.dart
index 480ad50c9987c2d9422a0a5799f907be54e3864e..baa4d3b9a67428ece2fb1ac749eba5a5d24512b2 100644
--- a/test/pubspec_test.dart
+++ b/test/pubspec_test.dart
@@ -405,42 +405,45 @@ dependencies:
});
group("environment", () {
- test("defaults to any SDK constraint if environment is omitted", () {
+ test("allows an omitted environment", () {
var pubspec = new Pubspec.parse('', sources);
- expect(pubspec.environment.sdkVersion, equals(VersionConstraint.any));
- });
-
- test("allows an empty environment map", () {
- var pubspec = new Pubspec.parse('''
-environment:
-''', sources);
- expect(pubspec.environment.sdkVersion, equals(VersionConstraint.any));
+ expect(pubspec.dartSdkConstraint, equals(VersionConstraint.any));
+ expect(pubspec.flutterSdkConstraint, isNull);
});
test("throws if the environment value isn't a map", () {
expectPubspecException('environment: []',
- (pubspec) => pubspec.environment);
+ (pubspec) => pubspec.dartSdkConstraint);
});
- test("allows a version constraint for the sdk", () {
+ test("allows a version constraint for the SDKs", () {
var pubspec = new Pubspec.parse('''
environment:
sdk: ">=1.2.3 <2.3.4"
+ flutter: ^0.1.2
''', sources);
- expect(pubspec.environment.sdkVersion,
+ expect(pubspec.dartSdkConstraint,
equals(new VersionConstraint.parse(">=1.2.3 <2.3.4")));
+ expect(pubspec.flutterSdkConstraint,
+ equals(new VersionConstraint.parse("^0.1.2")));
});
test("throws if the sdk isn't a string", () {
expectPubspecException('environment: {sdk: []}',
- (pubspec) => pubspec.environment);
+ (pubspec) => pubspec.dartSdkConstraint);
expectPubspecException('environment: {sdk: 1.0}',
- (pubspec) => pubspec.environment);
+ (pubspec) => pubspec.dartSdkConstraint);
+ expectPubspecException('environment: {sdk: 1.2.3, flutter: []}',
+ (pubspec) => pubspec.dartSdkConstraint);
+ expectPubspecException('environment: {sdk: 1.2.3, flutter: 1.0}',
+ (pubspec) => pubspec.dartSdkConstraint);
});
test("throws if the sdk isn't a valid version constraint", () {
expectPubspecException('environment: {sdk: "oopies"}',
- (pubspec) => pubspec.environment);
+ (pubspec) => pubspec.dartSdkConstraint);
+ expectPubspecException('environment: {sdk: 1.2.3, flutter: "oopies"}',
+ (pubspec) => pubspec.dartSdkConstraint);
});
});
« no previous file with comments | « test/must_pub_get_test.dart ('k') | test/version_solver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698