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

Unified Diff: test/version_test.dart

Issue 2045803002: Add VersionConstraint.difference(). (Closed) Base URL: git@github.com:dart-lang/pub_semver@master
Patch Set: Code review changes Created 4 years, 6 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/version_range_test.dart ('k') | test/version_union_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/version_test.dart
diff --git a/test/version_test.dart b/test/version_test.dart
index ddc6c94b5a371602fb929f0432f74366deef0581..b278d4c6115919cfa2ef4d1acd069473908bea27 100644
--- a/test/version_test.dart
+++ b/test/version_test.dart
@@ -202,6 +202,27 @@ main() {
});
});
+ group('difference()', () {
+ test("with the same version returns an empty constraint", () {
+ expect(v123.difference(v123), isEmpty);
+ });
+
+ test("with a different version returns the original version", () {
+ expect(v123.difference(v080), equals(v123));
+ });
+
+ test("returns an empty constraint with a range that contains the version",
+ () {
+ expect(v123.difference(new VersionRange(min: v114, max: v124)), isEmpty);
+ });
+
+ test("returns the version constraint with a range that doesn't contain it",
+ () {
+ expect(v123.difference(new VersionRange(min: v140, max: v300)),
+ equals(v123));
+ });
+ });
+
test('isEmpty', () {
expect(v123.isEmpty, isFalse);
});
« no previous file with comments | « test/version_range_test.dart ('k') | test/version_union_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698