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

Unified Diff: utils/tests/pub/pubspec_test.dart

Issue 12038038: Add support for specifying SDK version constraints in pubspecs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Clean up a bit. Created 7 years, 11 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 | « utils/tests/pub/command_line_config.dart ('k') | utils/tests/pub/version_solver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/tests/pub/pubspec_test.dart
diff --git a/utils/tests/pub/pubspec_test.dart b/utils/tests/pub/pubspec_test.dart
index dabb7dd44508643b00b6acb5dbc36e55e1592009..cb0402da9b276ed01ed3fd40154e3c0dbcbacb26 100644
--- a/utils/tests/pub/pubspec_test.dart
+++ b/utils/tests/pub/pubspec_test.dart
@@ -5,6 +5,7 @@
library pubspec_test;
import '../../../pkg/unittest/lib/unittest.dart';
+import 'test_pub.dart';
import '../../pub/pubspec.dart';
import '../../pub/source.dart';
import '../../pub/source_registry.dart';
@@ -112,6 +113,49 @@ dependencies:
expect(pubspec.version, equals(Version.none));
expect(pubspec.dependencies, isEmpty);
});
+
+ group("environment", () {
+ test("defaults to any SDK constraint if environment is omitted", () {
+ 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));
+ });
+
+ test("throws if the environment value isn't a map", () {
+ expectFormatError('''
+environment: []
+''');
+ });
+
+ test("allows a version constraint for the sdk", () {
+ var pubspec = new Pubspec.parse('''
+environment:
+ sdk: ">=1.2.3 <2.3.4"
+''', sources);
+ expect(pubspec.environment.sdkVersion,
+ equals(new VersionConstraint.parse(">=1.2.3 <2.3.4")));
+ });
+
+ test("throws if the sdk isn't a string", () {
+ expectFormatError('''
+environment:
+ sdk: []
+''');
+ });
+
+ test("throws if the sdk isn't a valid version constraint", () {
+ expectFormatError('''
+environment:
+ sdk: "oopies"
+''');
+ });
+ });
});
});
}
« no previous file with comments | « utils/tests/pub/command_line_config.dart ('k') | utils/tests/pub/version_solver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698