Skip to content
This repository was archived by the owner on Mar 21, 2023. It is now read-only.

Commit

Permalink
Test: Add SemVer test
Browse files Browse the repository at this point in the history
  • Loading branch information
AtjonTV committed Jun 3, 2020
1 parent e7bc594 commit b7e766a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/test/kotlin/klib/SemVerTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package klib

import klib.exceptions.InvalidTypeException
import kotlin.test.assertFailsWith
import kotlin.test.assertTrue
import org.junit.Test

class SemVerTest {
@Test
fun `SemVer is able to parse a valid Version string`() {
val sv = SemVer.parse("1.3.4-rc+b100")
assertTrue {
sv.major == 1 && sv.minor == 3 && sv.patch == 4 && sv.preRelease == "rc" && sv.buildMetadata == "b100"
}
}

@Test
fun `SemVer throws a InvalidTypeException when trying to parse an invalid Version string`() {
assertFailsWith<InvalidTypeException> {
SemVer.parse("1.3.4_-rc+b100")
}
}
}

0 comments on commit b7e766a

Please sign in to comment.