-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve the project's version as a semantic version number. Created …
…two version of parsing version string, one falls back to generic version, the other returns VersionNumber.UNKNOWN when parsing fails like in previous bld versions.
- Loading branch information
Showing
17 changed files
with
169 additions
and
60 deletions.
There are no files selected for viewing
Submodule core
updated
4 files
+2 −2 | .idea/libraries/bld.xml | |
+ − | lib/bld/bld-wrapper.jar | |
+1 −1 | lib/bld/bld-wrapper.properties | |
+2 −1 | src/bld/java/rife/CoreBuild.java |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Copyright 2001-2023 Geert Bevin (gbevin[remove] at uwyn dot com) | ||
* Licensed under the Apache License, Version 2.0 (the "License") | ||
*/ | ||
package rife.bld.dependencies; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class TestVersion { | ||
@Test | ||
void testParsing() { | ||
assertEquals(Version.parse("1"), new VersionNumber(1, 0, 0, null)); | ||
assertEquals(Version.parse("1.0"), new VersionNumber(1, 0, 0, null)); | ||
assertEquals(Version.parse("1.0.0"), new VersionNumber(1, 0, 0, null)); | ||
|
||
assertEquals(Version.parse("1.2"), new VersionNumber(1, 2, 0, null)); | ||
assertEquals(Version.parse("1.2.3"), new VersionNumber(1, 2, 3, null)); | ||
|
||
assertEquals(Version.parse("1-rc1-SNAPSHOT"), new VersionNumber(1, 0, 0, "rc1-SNAPSHOT")); | ||
assertEquals(Version.parse("1.2-rc1-SNAPSHOT"), new VersionNumber(1, 2, 0, "rc1-SNAPSHOT")); | ||
assertEquals(Version.parse("1.2.3-rc1-SNAPSHOT"), new VersionNumber(1, 2, 3, "rc1-SNAPSHOT")); | ||
|
||
assertEquals(Version.parse("11.22"), new VersionNumber(11, 22, 0, null)); | ||
assertEquals(Version.parse("11.22.33"), new VersionNumber(11, 22, 33, null)); | ||
assertEquals(Version.parse("11.22.33-eap"), new VersionNumber(11, 22, 33, "eap")); | ||
|
||
assertEquals(Version.parse("11.fortyfour"), new VersionNumber(11, 0, 0, "fortyfour")); | ||
|
||
assertEquals(Version.parse("1.0.0.0"), new VersionNumber(1, 0, 0, "0")); | ||
assertEquals(Version.parse("1.0.0.0.0.0.0"), new VersionNumber(1, 0, 0, "0.0.0.0")); | ||
assertEquals(Version.parse("1.2.3.4-rc1-SNAPSHOT"), new VersionNumber(1, 2, 3, "4-rc1-SNAPSHOT")); | ||
assertEquals(Version.parse("1.2.3.4.rc1-SNAPSHOT"), new VersionNumber(1, 2, 3, "4.rc1-SNAPSHOT")); | ||
|
||
assertEquals(Version.parse("1.2.3_4"), new VersionNumber(1, 2, 0, "3_4")); | ||
assertEquals(Version.parse("1.54b"), new VersionNumber(1, 0, 0, "54b")); | ||
|
||
assertEquals(Version.parse("2024-02"), new VersionNumber(2024, null, null, "02")); | ||
assertEquals(Version.parse("2.0-05"), new VersionNumber(2, 0, null, "05")); | ||
assertEquals(Version.parse("2024.02"), new VersionNumber(2024, null, null, "02", ".")); | ||
assertEquals(Version.parse("2.0.05"), new VersionNumber(2, 0, null, "05", ".")); | ||
|
||
assertEquals(Version.parse("v3-rev20240514-2.0.0"), new VersionGeneric("v3-rev20240514-2.0.0")); | ||
} | ||
|
||
@Test | ||
void testInvalidParsed() { | ||
assertEquals(Version.parse(null), VersionNumber.UNKNOWN); | ||
assertEquals(Version.parse(""), VersionNumber.UNKNOWN); | ||
assertEquals(Version.parse("foo"), new VersionGeneric("foo")); | ||
assertEquals(Version.parse("1."), new VersionGeneric("1.")); | ||
assertEquals(Version.parse("1.2.3-"), new VersionGeneric("1.2.3-")); | ||
assertEquals(Version.parse("."), new VersionGeneric(".")); | ||
assertEquals(Version.parse("_"), new VersionGeneric("_")); | ||
assertEquals(Version.parse("-"), new VersionGeneric("-")); | ||
assertEquals(Version.parse(".1"), new VersionGeneric(".1")); | ||
assertEquals(Version.parse("a.1"), new VersionGeneric("a.1")); | ||
assertEquals(Version.parse("1_2"), new VersionGeneric("1_2")); | ||
assertEquals(Version.parse("1_2_2"), new VersionGeneric("1_2_2")); | ||
} | ||
|
||
@Test | ||
void testStringRepresentation() { | ||
assertEquals(Version.parse("1.0").toString(), "1.0"); | ||
assertEquals(Version.parse("1.2.3").toString(), "1.2.3"); | ||
assertEquals(Version.parse("1.2.3-4").toString(), "1.2.3-4"); | ||
assertEquals(Version.parse("1.2.3.4").toString(), "1.2.3.4"); | ||
assertEquals(Version.parse("1-rc-1").toString(), "1-rc-1"); | ||
assertEquals(Version.parse("1.2.3-rc-1").toString(), "1.2.3-rc-1"); | ||
assertEquals(Version.parse("1.2.3.rc-1").toString(), "1.2.3.rc-1"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.