Added copyright. Fixed typos.
This commit is contained in:
parent
d4fe2807d3
commit
0929d9f5a1
2 changed files with 36 additions and 5 deletions
|
@ -1,3 +1,34 @@
|
||||||
|
/*
|
||||||
|
* SemverVersionSpec.kt
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018-2019, Erik C. Thauvin (erik@thauvin.net)
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* Neither the name of this project nor the names of its contributors may be
|
||||||
|
* used to endorse or promote products derived from this software without
|
||||||
|
* specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
package net.thauvin.erik.gradle.semver
|
package net.thauvin.erik.gradle.semver
|
||||||
|
|
||||||
import org.spekframework.spek2.Spek
|
import org.spekframework.spek2.Spek
|
||||||
|
@ -29,14 +60,14 @@ object SemverPluginSpec : Spek({
|
||||||
val props = Properties().apply {
|
val props = Properties().apply {
|
||||||
Files.newInputStream(configFile.toPath()).use { nis ->
|
Files.newInputStream(configFile.toPath()).use { nis ->
|
||||||
load(nis)
|
load(nis)
|
||||||
configFile.delete()
|
|
||||||
}
|
}
|
||||||
|
configFile.delete()
|
||||||
}
|
}
|
||||||
|
|
||||||
assertEquals(props.getProperty(config.majorKey), version.major, "Major")
|
assertEquals(props.getProperty(config.majorKey), version.major, "Major")
|
||||||
assertEquals(props.getProperty(config.minorKey), version.minor, "Minor")
|
assertEquals(props.getProperty(config.minorKey), version.minor, "Minor")
|
||||||
assertEquals(props.getProperty(config.patchKey), version.patch, "Patch")
|
assertEquals(props.getProperty(config.patchKey), version.patch, "Patch")
|
||||||
assertEquals(props.getProperty(config.preReleaseKey), version.preRelease, "PreRelease.")
|
assertEquals(props.getProperty(config.preReleaseKey), version.preRelease, "PreRelease")
|
||||||
assertNull(props.getProperty(config.preReleasePrefixKey), "PreRelease Prefix")
|
assertNull(props.getProperty(config.preReleasePrefixKey), "PreRelease Prefix")
|
||||||
assertEquals(props.getProperty(config.buildMetaKey), version.buildMeta, "Build Meta")
|
assertEquals(props.getProperty(config.buildMetaKey), version.buildMeta, "Build Meta")
|
||||||
assertNull(props.getProperty(config.buildMetaPrefixKey), "Build Meta Prefix")
|
assertNull(props.getProperty(config.buildMetaPrefixKey), "Build Meta Prefix")
|
||||||
|
|
|
@ -37,9 +37,9 @@ import kotlin.test.assertEquals
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object SemverVersionSpec : Spek({
|
object SemverVersionSpec : Spek({
|
||||||
describe("a version") {
|
describe("test version") {
|
||||||
val version = Version()
|
val version = Version()
|
||||||
describe("valdiate default version") {
|
describe("validate default version") {
|
||||||
it("major should be 1") {
|
it("major should be 1") {
|
||||||
assertEquals("1", version.major)
|
assertEquals("1", version.major)
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ object SemverVersionSpec : Spek({
|
||||||
assertEquals("1.0.0", version.semver)
|
assertEquals("1.0.0", version.semver)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
describe("increment major") {
|
describe("increment") {
|
||||||
it("should return 2.0.0") {
|
it("should return 2.0.0") {
|
||||||
version.increment(isMajor = true)
|
version.increment(isMajor = true)
|
||||||
assertEquals("2.0.0", version.semver)
|
assertEquals("2.0.0", version.semver)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue