Skip to content

Commit

Permalink
(#22) Add tests for mutable collections
Browse files Browse the repository at this point in the history
  • Loading branch information
jayasuryat committed Mar 5, 2024
1 parent 4c6504e commit 3661caa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package com.jayasuryat.dowel.sample.ui.home.model

import androidx.annotation.DrawableRes
import androidx.annotation.Size
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.State
import androidx.compose.ui.graphics.Color
import com.jayasuryat.dowel.annotation.Dowel
Expand Down Expand Up @@ -49,10 +50,15 @@ data class Person(
val meta: SomeStaticInfo,
val customType: UnsupportedType = UnsupportedType.SomeType,
@Size(value = 2) val locations: List<Location>,
@Size(value = 2) val mutableLocations: MutableList<Location>,
@Size(value = 3) val uniqueLocations: Set<Location>,
@Size(value = 3) val mutableUniqueLocations: MutableSet<Location>,
val isExpanded: State<Boolean>,
val mutableIsExpanded: MutableState<Boolean>,
@Size(value = 1) val preferences: Map<Long, Location>,
@Size(value = 1) val mutablePreferences: MutableMap<Long, Location>,
@Size(value = 2) val preferredLocations: Map<Long, Set<Location>>,
@Size(value = 2) val mutablePreferredLocations: Map<Long, MutableSet<Location>>,
val title: Char,
@Size(value = 1) val interests: List<Float>,
val onClick: suspend (a: Person, b: Int) -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ internal class DowelWholeEnchiladaProcessingTest {
val source = """
package androidx.compose.runtime
interface State<T>
interface MutableState<T> : State<T>
fun <T> mutableStateOf(value: T): State<T> = object : State<T> {}
fun <T> mutableStateOf(value: T): MutableState<T> = object : MutableState<T> {}
""".trimIndent()
SourceFile.kotlin(name = "SnapshotState.kt", contents = source)
}
Expand Down Expand Up @@ -200,6 +201,7 @@ internal class DowelWholeEnchiladaProcessingTest {
import com.jayasuryat.dowel.annotation.Dowel
import androidx.annotation.Size
import androidx.compose.runtime.State
import androidx.compose.runtime.MutableState
import kotlinx.coroutines.flow.Flow
import dowel.status.Status
import dowel.vehicle.Vehicle
Expand All @@ -224,10 +226,15 @@ internal class DowelWholeEnchiladaProcessingTest {
val info: SomeStaticInfo,
val bannerColor : Color,
@Size(value = 2) val locations: List<Location>,
@Size(value = 2) val mutableLocations: MutableList<Location>,
@Size(value = 3) val uniqueLocations: Set<Location>,
@Size(value = 3) val uniqueMutableLocations: MutableSet<Location>,
val isExpanded: State<Boolean>,
val mutableIsExpanded: MutableState<Boolean>,
@Size(value = 1) val preferences: Map<Long, Location>,
@Size(value = 1) val mutablePreferences: MutableMap<Long, Location>,
@Size(value = 2) val preferredLocations: Map<Long, Set<Location>>,
@Size(value = 2) val preferredMutableLocations: Map<Long, MutableSet<Location>>,
val title: Char,
@Size(value = 1) val interests: List<Float>,
@Size(value = 2) val uniqueInterests: Set<Float>,
Expand Down

0 comments on commit 3661caa

Please sign in to comment.