Make zipWithNext work & add test

This commit is contained in:
Vitaliy.Bibaev
2017-12-21 15:49:20 +03:00
committed by Yan Zhulanow
parent d8bc73367f
commit eaee6697f2
2 changed files with 11 additions and 12 deletions
@@ -4,6 +4,7 @@ package com.intellij.debugger.streams.kotlin.lib.sequence
import com.intellij.debugger.streams.lib.IntermediateOperation import com.intellij.debugger.streams.lib.IntermediateOperation
import com.intellij.debugger.streams.lib.impl.* import com.intellij.debugger.streams.lib.impl.*
import com.intellij.debugger.streams.resolve.AppendResolver import com.intellij.debugger.streams.resolve.AppendResolver
import com.intellij.debugger.streams.resolve.PairMapResolver
import com.intellij.debugger.streams.trace.impl.handler.unified.DistinctByKeyHandler import com.intellij.debugger.streams.trace.impl.handler.unified.DistinctByKeyHandler
import com.intellij.debugger.streams.trace.impl.handler.unified.DistinctTraceHandler import com.intellij.debugger.streams.trace.impl.handler.unified.DistinctTraceHandler
@@ -28,7 +29,7 @@ class KotlinSequencesSupport : LibrarySupportBase() {
addIntermediateOperationsSupport(ConcatOperation("plus", AppendResolver())) addIntermediateOperationsSupport(ConcatOperation("plus", AppendResolver()))
addIntermediateOperationsSupport(ConcatOperation("plusElement", AppendResolver())) addIntermediateOperationsSupport(ConcatOperation("plusElement", AppendResolver()))
addIntermediateOperationsSupport() addIntermediateOperationsSupport(OrderBasedOperation("zipWithNext", PairMapResolver()))
} }
private fun filterOperations(vararg names: String): Array<IntermediateOperation> = private fun filterOperations(vararg names: String): Array<IntermediateOperation> =
@@ -13,16 +13,16 @@ count
after: nothing after: nothing
mappings for zipWithNext mappings for zipWithNext
direct: direct:
1 -> nothing 1 -> 3
2 -> nothing 2 -> 3,5
4 -> nothing 4 -> 5,7
6 -> nothing 6 -> 7,9
8 -> nothing 8 -> 9
reverse: reverse:
nothing <- 3 1,2 <- 3
nothing <- 5 2,4 <- 5
nothing <- 7 4,6 <- 7
nothing <- 9 6,8 <- 9
mappings for count mappings for count
direct: direct:
3 -> nothing 3 -> nothing
@@ -33,6 +33,4 @@ mappings for count
empty empty
Disconnected from the target VM Disconnected from the target VM
WRONG
Process finished with exit code 0 Process finished with exit code 0