Skip to content

Commit

Permalink
Fix ServerVersion comparison failing when build is not set (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Apr 19, 2022
1 parent 44818c0 commit 2b3911e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public data class ServerVersion(
{ it.major },
{ it.minor },
{ it.patch },
{ it.build ?: -1 }
{ it.build ?: 0 }
)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.jellyfin.sdk.model.discovery
import org.jellyfin.sdk.model.ServerVersion
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNull
import kotlin.test.assertTrue

Expand Down Expand Up @@ -39,5 +40,8 @@ class ServerVersionTests {
assertTrue { ServerVersion(1, 2, 3) > ServerVersion(0, 0, 0) }

assertTrue { ServerVersion(1, 7, 0, 1) > ServerVersion(1, 7, 0) }

assertFalse { ServerVersion.fromString("10.8.0")!! < ServerVersion(10, 8, 0, 0) }
assertFalse { ServerVersion.fromString("10.8.0")!! < ServerVersion.fromString("10.8.0")!! }
}
}

0 comments on commit 2b3911e

Please sign in to comment.