File tree Expand file tree Collapse file tree
main/java/com/clhs/score/data
test/java/com/clhs/score/data Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ class UpdateChecker(
9393
9494 private fun isNewer (remote : String , current : String ): Boolean? {
9595 val remoteParts = remote.versionPartsOrNull() ? : return null
96- val currentParts = current.versionPartsOrNull() ? : return null
96+ val currentParts = current.substringBefore( ' - ' ). versionPartsOrNull() ? : return null
9797 val maxLen = maxOf(remoteParts.size, currentParts.size)
9898 for (i in 0 until maxLen) {
9999 val r = remoteParts.getOrElse(i) { 0 }
Original file line number Diff line number Diff line change @@ -79,6 +79,24 @@ class UpdateCheckerTest {
7979 assertEquals(UpdateResult .UpToDate , checker().check(" 1.2.0" ))
8080 }
8181
82+ @Test
83+ fun debugVersionSuffixDoesNotBreakComparison () = runTest {
84+ server.enqueue(
85+ jsonResponse(
86+ """
87+ {
88+ "tag_name": "v1.2.4",
89+ "html_url": "https://github.com/alvin000009238/clhs_score/releases/tag/v1.2.4",
90+ "body": "",
91+ "assets": []
92+ }
93+ """ .trimIndent(),
94+ ),
95+ )
96+
97+ assertTrue(checker().check(" 1.0-debug" ) is UpdateResult .NewVersion )
98+ }
99+
82100 @Test
83101 fun invalidReleaseLinksReturnErrorInsteadOfActionableUpdate () = runTest {
84102 server.enqueue(
You can’t perform that action at this time.
0 commit comments