Add 'asSequence' operation support
This commit is contained in:
committed by
Yan Zhulanow
parent
64dec10bd5
commit
bde34b45e7
+1
-1
@@ -16,7 +16,7 @@ import com.intellij.debugger.streams.trace.impl.handler.unified.DistinctTraceHan
|
||||
class KotlinSequencesSupport : LibrarySupportBase() {
|
||||
init {
|
||||
addIntermediateOperationsSupport(*filterOperations("filter", "filterNot", "filterIndexed",
|
||||
"filterIsInstance", "drop", "dropWhile", "minus", "minusElement", "take", "takeWhile", "onEach"))
|
||||
"filterIsInstance", "drop", "dropWhile", "minus", "minusElement", "take", "takeWhile", "onEach", "asSequence"))
|
||||
|
||||
addIntermediateOperationsSupport(*mapOperations("map", "mapIndexed", "requireNoNulls", "withIndex",
|
||||
"zip", "constrainOnce"))
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
LineBreakpoint created at AsSequence.kt:5
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
AsSequence.kt:5
|
||||
sequenceOf(1, 2, 3)
|
||||
.asSequence()
|
||||
.count()
|
||||
asSequence
|
||||
before: 1,3,5
|
||||
after: 2,4,6
|
||||
count
|
||||
before: 2,4,6
|
||||
after: nothing
|
||||
mappings for asSequence
|
||||
direct:
|
||||
1 -> 2
|
||||
3 -> 4
|
||||
5 -> 6
|
||||
reverse:
|
||||
1 <- 2
|
||||
3 <- 4
|
||||
5 <- 6
|
||||
mappings for count
|
||||
direct:
|
||||
2 -> nothing
|
||||
4 -> nothing
|
||||
6 -> nothing
|
||||
reverse:
|
||||
empty
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
@@ -0,0 +1,6 @@
|
||||
package misc
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
// Breakpoint!
|
||||
sequenceOf(1, 2, 3).asSequence().count()
|
||||
}
|
||||
@@ -25,4 +25,6 @@ class MiscOperationsTest : OperationsTestCase("misc") {
|
||||
fun testWindowedWithPartial() = doTestWithResult()
|
||||
fun testWindowedWithBigStep() = doTestWithResult()
|
||||
fun testWindowedWithStep() = doTestWithResult()
|
||||
|
||||
fun testAsSequence() = doTestWithResult()
|
||||
}
|
||||
@@ -9,8 +9,8 @@ abstract class OperationsTestCase(private val packageName: String) : KotlinTrace
|
||||
override val appName: String = "sequence"
|
||||
override val librarySupport: LibrarySupportProvider = KotlinSequenceSupportProvider()
|
||||
|
||||
fun doTestWithResult() = doTest(false, fullyQualifiedClassName())
|
||||
fun doTestWithoutResult() = doTest(true, fullyQualifiedClassName())
|
||||
protected fun doTestWithResult() = doTest(false, fullyQualifiedClassName())
|
||||
protected fun doTestWithoutResult() = doTest(true, fullyQualifiedClassName())
|
||||
|
||||
private fun fullyQualifiedClassName() = "$packageName.${getTestName(false)}"
|
||||
}
|
||||
Reference in New Issue
Block a user