File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
main/kotlin/io/github/typesafegithub/workflows/shared/internal/model
test/kotlin/io/github/typesafegithub/workflows/shared/internal/model Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ data class Version(
25
25
26
26
override fun toString (): String = version
27
27
28
- fun isMajorVersion (): Boolean = version.contains( " . " ). not ()
28
+ fun isMajorVersion (): Boolean = version.removePrefix( " v " ).removePrefix( " V " ).toIntOrNull() != null
29
29
30
30
suspend fun getReleaseDate () = dateProvider()
31
31
}
Original file line number Diff line number Diff line change @@ -11,9 +11,8 @@ class VersionTest :
11
11
Pair (" v1.2" , false ),
12
12
Pair (" v3" , true ),
13
13
Pair (" V3" , true ),
14
- // Incorrect behavior, will be fixed in https://github.com/typesafegithub/github-workflows-kt/issues/1670
15
- Pair (" v3-prerelease" , true ),
16
- Pair (" beta-v3" , true ),
14
+ Pair (" v3-prerelease" , false ),
15
+ Pair (" beta-v3" , false ),
17
16
).forEach { (version, isMajor) ->
18
17
test(" isMajorVersion works correctly for $version " ) {
19
18
Version (version).isMajorVersion() shouldBe isMajor
You can’t perform that action at this time.
0 commit comments