Browse Source

web: Add failing tests for composables passed into constructors (issue #746)

pull/1066/head
Oleksandr Karpovich 3 years ago
parent
commit
00d0ee008f
  1. 15
      web/core/src/jsTest/kotlin/FailingTestCases.kt

15
web/core/src/jsTest/kotlin/FailingTestCases.kt

@ -5,7 +5,9 @@
package org.jetbrains.compose.web.core.tests
import androidx.compose.runtime.Composable
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
class FailingTestCases {
@ -22,6 +24,19 @@ class FailingTestCases {
}
assertTrue(expectedErrorThrown)
}
data class DataClassTakesComposable(val c: @Composable () -> Unit)
class UsualClassTakesComposable(val c: @Composable () -> Unit)
@Test
fun passingComposableIntoConstructorOfDataClass() {
check(DataClassTakesComposable {}.c == null) // Expected behaviour: c != null
}
@Test
fun passingComposableIntoConstructorOfUsualClass() {
check(UsualClassTakesComposable {}.c == null) // Expected behaviour: c != null
}
}
@Suppress("Unused", "NOTHING_TO_INLINE", "NESTED_CLASS_IN_EXTERNAL_INTERFACE", "INLINE_EXTERNAL_DECLARATION", "WRONG_BODY_OF_EXTERNAL_DECLARATION", "NESTED_EXTERNAL_DECLARATION", "ClassName")

Loading…
Cancel
Save