Skip to content

Commit

Permalink
Add a test to prevent the Semver#statisfies(String) bugs when adding …
Browse files Browse the repository at this point in the history
…a new type
  • Loading branch information
vdurmont committed Aug 21, 2015
1 parent 4b1a81f commit be80939
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/test/java/com/vdurmont/semver4j/SemverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@ private static void assertIsSemver(Semver semver, String value, Integer major, I
assertEquals(build, semver.getBuild());
}

@Test public void statisfies_with_cocoapods() {
String version = "1.2.3";
Semver semver = new Semver(version, Semver.SemverType.COCOAPODS);
assertTrue(semver.satisfies("~> 1.2.1"));
assertFalse(semver.satisfies("~> 1.3.1"));
@Test public void statisfies_works_will_all_the_types() {
// Used to prevent bugs when we add a new type
for (Semver.SemverType type : Semver.SemverType.values()) {
String version = "1.2.3";
Semver semver = new Semver(version, type);
assertTrue(semver.satisfies("1.2.3"));
assertFalse(semver.satisfies("4.5.6"));
}
}

@Test public void isGreaterThan_test() {
Expand Down

0 comments on commit be80939

Please sign in to comment.