Skip to content

Commit

Permalink
web: Add failing tests for composables passed into constructors (issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Karpovich committed Aug 16, 2021
1 parent 1561b27 commit 00d0ee0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions web/core/src/jsTest/kotlin/FailingTestCases.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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")
Expand Down

0 comments on commit 00d0ee0

Please sign in to comment.