-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:smithy-lang/smithy-kotlin into v1.4
- Loading branch information
Showing
9 changed files
with
95 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
runtime/runtime-core/common/test/aws/smithy/kotlin/runtime/util/JmesPathTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package aws.smithy.kotlin.runtime.util | ||
|
||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertTrue | ||
|
||
class JmesPathTest { | ||
@Test | ||
fun flattenNestedLists() { | ||
val nestedList = listOf( | ||
listOf(1, 2, 3), | ||
listOf(4, 5), | ||
listOf(6), | ||
) | ||
val flattenedList = nestedList.flattenIfPossible() | ||
assertEquals(listOf(1, 2, 3, 4, 5, 6), flattenedList) | ||
} | ||
|
||
@Test | ||
fun flattenEmptyNestedLists() { | ||
val nestedList = listOf( | ||
listOf<Int>(), | ||
listOf(), | ||
listOf(), | ||
) | ||
val flattenedList = nestedList.flattenIfPossible() | ||
assertTrue(flattenedList.isEmpty()) | ||
} | ||
|
||
@Test | ||
fun flattenNestedEmptyAndNonEmptyNestedLists() { | ||
val nestedList = listOf( | ||
listOf(1, 2), | ||
listOf(), | ||
listOf(3, 4, 5), | ||
) | ||
val flattenedList = nestedList.flattenIfPossible() | ||
assertEquals(listOf(1, 2, 3, 4, 5), flattenedList) | ||
} | ||
|
||
@Test | ||
fun flattenList() { | ||
val nestedList = listOf( | ||
listOf(1, 2, 3), | ||
) | ||
val flattenedList = nestedList.flattenIfPossible() | ||
assertEquals(listOf(1, 2, 3), flattenedList) | ||
} | ||
} |