-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
14 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,21 +1,25 @@ | ||
import static org.junit.Assert.* | ||
import org.junit.Test | ||
package com.genexus | ||
|
||
import com.genexus.FileHelper | ||
|
||
class FileHelperTest { | ||
@Test | ||
void testStandardizeVersionForSemVer() { | ||
FileHelper fileHelper = new FileHelper() | ||
|
||
// Test case 1: Standard version without label | ||
String result1 = fileHelper.standarizeVersionForSemVer("1.3.5", "88", "") | ||
assertEquals("1.3.88", result1) | ||
static void main(String[] args) { | ||
def instance = new FileHelper() // Create an instance of your class | ||
|
||
// Define test cases | ||
def tests = [ | ||
['1.3.5', '88', '', 0, '1.3.88'], | ||
['2.1.5', '457', 'beta', 0, '2.1.0-beta.457'], | ||
['1.3.5', '88', '', 100, '101.3.88'] | ||
] | ||
|
||
// Test case 2: Version with 'beta' label | ||
String result2 = fileHelper.standarizeVersionForSemVer("2.1.5", "457", "beta") | ||
assertEquals("2.1.0-beta.457", result2) | ||
// Run tests | ||
tests.each { testCase -> | ||
String version = instance.standarizeVersionForSemVer(testCase[0], testCase[1], testCase[2], testCase[3]) | ||
assert version == testCase[4] : "Expected ${testCase[4]}, but got ${version}" | ||
} | ||
|
||
// Test case 3: Increase major version by 100 without label | ||
String result3 = fileHelper.standarizeVersionForSemVer("1.3.5", "88", "", 100) | ||
assertEquals("101.3.88", result3) | ||
println "All tests passed!" | ||
} | ||
} |