aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Eluard <[email protected]>2012-01-28 00:15:16 -0300
committerJulien Eluard <[email protected]>2012-01-28 00:15:16 -0300
commit9f57c38b8f5d30557686425f0bf1665dcc306b09 (patch)
tree726141d510e5dd7a7dae02614e4a6ab1398ddfd0
parent8cfa9e53549667a62b28999d1dd43a6c4b7449a5 (diff)
Fixes #1.
-rwxr-xr-xapi/src/main/java/org/semver/Version.java4
-rwxr-xr-xapi/src/test/java/org/semver/VersionTest.java2
2 files changed, 4 insertions, 2 deletions
diff --git a/api/src/main/java/org/semver/Version.java b/api/src/main/java/org/semver/Version.java
index 1a1b501..a6871b5 100755
--- a/api/src/main/java/org/semver/Version.java
+++ b/api/src/main/java/org/semver/Version.java
@@ -32,7 +32,7 @@ import javax.annotation.concurrent.Immutable;
*/
@Immutable
public final class Version implements Comparable<Version> {
-
+
/**
* {@link Version} element. From most meaningful to less meaningful.
*/
@@ -40,7 +40,7 @@ public final class Version implements Comparable<Version> {
MAJOR, MINOR, PATCH, SPECIAL;
}
- private static final String FORMAT = "(\\d)\\.(\\d)(?:\\.)?(\\d)?(?:\\.|-)?([A-Za-z][0-9A-Za-z-]*)?";
+ private static final String FORMAT = "(\\d)+\\.(\\d)+(?:\\.)?(\\d)*(?:\\.|-)?([A-Za-z][0-9A-Za-z-]*)?";
private static final Pattern PATTERN = Pattern.compile(Version.FORMAT);
private static final String SNAPSHOT_VERSION_SUFFIX = "-SNAPSHOT";
diff --git a/api/src/test/java/org/semver/VersionTest.java b/api/src/test/java/org/semver/VersionTest.java
index 8797b22..9ba6e2d 100755
--- a/api/src/test/java/org/semver/VersionTest.java
+++ b/api/src/test/java/org/semver/VersionTest.java
@@ -46,9 +46,11 @@ public class VersionTest {
public void shouldValidVersionBeParsed() {
Version.parse("1.2");
Version.parse("1.2.3");
+ Version.parse("10.20.30");
Version.parse("1.2.3beta");
Version.parse("1.2.3.DEV");
Version.parse("1.2.3.DEV-SNAPSHOT");
+ Version.parse("1.2-SNAPSHOT");
Version.parse("1.2.3-SNAPSHOT");
Version.parse("1.2.3-RC-SNAPSHOT");
Version.parse("1.2-RC-SNAPSHOT");