Suppress unreachable code warnings in MapTest

These are intentional and are necessary to identify broken behaviour in
future, therefore the warnings are redundant.
This commit is contained in:
Michael Bull 2017-11-22 23:41:32 +00:00
parent 4e22fe4f02
commit b513c09470

View File

@ -19,13 +19,12 @@ internal class MapTest {
@Test @Test
internal fun `map should return the transformed result value if ok`() { internal fun `map should return the transformed result value if ok`() {
val test: Result<Int, Nothing> = Ok(500).map { 50 }
val value = Ok(10).map { it + 20 }.get() val value = Ok(10).map { it + 20 }.get()
assertThat(value, equalTo(30)) assertThat(value, equalTo(30))
} }
@Test @Test
@Suppress("UNREACHABLE_CODE")
internal fun `map should return the result error if not ok`() { internal fun `map should return the result error if not ok`() {
val result = Err(MapError.HelloError).map { "hello $it" } val result = Err(MapError.HelloError).map { "hello $it" }
@ -58,6 +57,7 @@ internal class MapTest {
} }
@Test @Test
@Suppress("UNREACHABLE_CODE")
internal fun `mapBoth should return the transformed result value if ok`() { internal fun `mapBoth should return the transformed result value if ok`() {
val value = Ok("there is").mapBoth( val value = Ok("there is").mapBoth(
success = { "$it a light" }, success = { "$it a light" },
@ -68,6 +68,7 @@ internal class MapTest {
} }
@Test @Test
@Suppress("UNREACHABLE_CODE")
internal fun `mapBoth should return the transformed result error if not ok`() { internal fun `mapBoth should return the transformed result error if not ok`() {
val error = Err(MapError.CustomError("this")).mapBoth( val error = Err(MapError.CustomError("this")).mapBoth(
success = { "$it charming" }, success = { "$it charming" },
@ -78,6 +79,7 @@ internal class MapTest {
} }
@Test @Test
@Suppress("UNREACHABLE_CODE")
internal fun `mapEither should return the transformed result value if ok`() { internal fun `mapEither should return the transformed result value if ok`() {
val result = Ok(500).mapEither( val result = Ok(500).mapEither(
success = { it + 500 }, success = { it + 500 },