Skip to content

Commit

Permalink
Merge pull request #1260 from square/joshwilliams/revert-text-control…
Browse files Browse the repository at this point in the history
…ler-equals

Reverts make `TextController` support equals
  • Loading branch information
jkwiz authored Feb 4, 2025
2 parents be834d1 + ee19c86 commit 3b1f13c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,4 @@ private class TextControllerImpl(initialValue: String) : TextController {
set(value) {
_textValue.value = value
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false

other as TextController

return textValue == other.textValue
}

override fun hashCode(): Int {
return textValue.hashCode()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import app.cash.turbine.test
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.test.runTest
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals

@OptIn(WorkflowUiExperimentalApi::class)
internal class TextControllerTest {
Expand Down Expand Up @@ -36,16 +34,4 @@ internal class TextControllerTest {
expectNoEvents()
}
}

@Test fun `equals works with the same value`() {
val controller1 = TextController(initialValue = "apple")
val controller2 = TextController(initialValue = "apple")
assertEquals(controller1, controller2)
}

@Test fun `equals works with different values`() {
val controller1 = TextController(initialValue = "apple")
val controller2 = TextController(initialValue = "orange")
assertNotEquals(controller1, controller2)
}
}

0 comments on commit 3b1f13c

Please sign in to comment.