mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-16 11:09:33 +02:00
32 lines
926 B
Groovy
32 lines
926 B
Groovy
|
package com.sap.piper.versioning
|
||
|
|
||
|
import org.junit.Rule
|
||
|
import org.junit.Test
|
||
|
import org.junit.rules.RuleChain
|
||
|
import util.BasePiperTest
|
||
|
import util.JenkinsReadFileRule
|
||
|
import util.JenkinsWriteFileRule
|
||
|
import util.Rules
|
||
|
|
||
|
import static org.junit.Assert.assertEquals
|
||
|
|
||
|
class GolangArtifactVersioningTest extends BasePiperTest{
|
||
|
|
||
|
JenkinsReadFileRule jrfr = new JenkinsReadFileRule(this, 'test/resources/versioning/GolangArtifactVersioning/')
|
||
|
JenkinsWriteFileRule jwfr = new JenkinsWriteFileRule(this)
|
||
|
|
||
|
@Rule
|
||
|
public RuleChain ruleChain = Rules
|
||
|
.getCommonRules(this)
|
||
|
.around(jrfr)
|
||
|
.around(jwfr)
|
||
|
|
||
|
@Test
|
||
|
void testVersioning() {
|
||
|
GolangArtifactVersioning av = new GolangArtifactVersioning(nullScript, [filePath: 'VERSION'])
|
||
|
assertEquals('1.2.3', av.getVersion())
|
||
|
av.setVersion('1.2.3-20180101')
|
||
|
assertEquals('1.2.3-20180101', jwfr.files['VERSION'])
|
||
|
}
|
||
|
}
|