From b916fc6ca2a9af3fae789c09d3697fc0447ba625 Mon Sep 17 00:00:00 2001 From: "Vitaliy.Bibaev" Date: Thu, 19 Oct 2017 15:11:17 +0300 Subject: [PATCH] Add simplest execution tests for support of kotlin collection --- .../collection/src/checks/AllMatchFalse.kt | 6 ++++++ .../exec/collection/src/checks/AllMatchTrue.kt | 6 ++++++ .../exec/collection/src/distinct/Distinct.kt | 6 ++++++ .../exec/collection/src/distinct/DistinctBy.kt | 6 ++++++ .../exec/collection/src/filter/Filter.kt | 6 ++++++ .../exec/collection/src/final/Average.kt | 6 ++++++ .../exec/collection/src/flatMap/FlatMap.kt | 6 ++++++ .../exec/collection/src/grouping/GroupBy.kt | 6 ++++++ .../sequence/exec/collection/src/map/Map.kt | 6 ++++++ .../collection/src/map/MapToSameCollection.kt | 8 ++++++++ .../exec/collection/src/misc/IndexOf.kt | 6 ++++++ .../exec/collection/src/zip/ZipWithGreater.kt | 6 ++++++ .../exec/collection/src/zip/ZipWithLesser.kt | 6 ++++++ .../exec/collection/src/zip/ZipWithSame.kt | 6 ++++++ .../kotlin/exec/collection/ChecksTest.kt | 14 ++++++++++++++ .../exec/collection/CollectionTestCase.kt | 17 +++++++++++++++++ .../exec/collection/DistinctOperationsTest.kt | 14 ++++++++++++++ .../exec/collection/FilterOperationsTest.kt | 10 ++++++++++ .../exec/collection/FinalOperationsTest.kt | 10 ++++++++++ .../exec/collection/FlatMapOperationsTest.kt | 10 ++++++++++ .../exec/collection/GroupingOperationsTest.kt | 10 ++++++++++ .../exec/collection/MapOperationsTest.kt | 14 ++++++++++++++ .../exec/collection/MiscOperationsTest.kt | 10 ++++++++++ .../exec/collection/ZipOperationsTest.kt | 18 ++++++++++++++++++ 24 files changed, 213 insertions(+) create mode 100644 idea/testData/debugger/sequence/exec/collection/src/checks/AllMatchFalse.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/checks/AllMatchTrue.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/distinct/Distinct.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/distinct/DistinctBy.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/filter/Filter.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/final/Average.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/flatMap/FlatMap.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/grouping/GroupBy.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/map/Map.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/map/MapToSameCollection.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/misc/IndexOf.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithGreater.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithLesser.kt create mode 100644 idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithSame.kt create mode 100644 idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/ChecksTest.kt create mode 100644 idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/CollectionTestCase.kt create mode 100644 idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/DistinctOperationsTest.kt create mode 100644 idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FilterOperationsTest.kt create mode 100644 idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FinalOperationsTest.kt create mode 100644 idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FlatMapOperationsTest.kt create mode 100644 idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/GroupingOperationsTest.kt create mode 100644 idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/MapOperationsTest.kt create mode 100644 idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/MiscOperationsTest.kt create mode 100644 idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/ZipOperationsTest.kt diff --git a/idea/testData/debugger/sequence/exec/collection/src/checks/AllMatchFalse.kt b/idea/testData/debugger/sequence/exec/collection/src/checks/AllMatchFalse.kt new file mode 100644 index 00000000000..319b1dbf7fa --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/checks/AllMatchFalse.kt @@ -0,0 +1,6 @@ +package checks + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2).all { it % 2 == 0 } +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/checks/AllMatchTrue.kt b/idea/testData/debugger/sequence/exec/collection/src/checks/AllMatchTrue.kt new file mode 100644 index 00000000000..d577c716332 --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/checks/AllMatchTrue.kt @@ -0,0 +1,6 @@ +package checks + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2).all { it < 10 } +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/distinct/Distinct.kt b/idea/testData/debugger/sequence/exec/collection/src/distinct/Distinct.kt new file mode 100644 index 00000000000..9f5b0ede024 --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/distinct/Distinct.kt @@ -0,0 +1,6 @@ +package distinct + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2, 3, 4, 3, 2, 1).distinct() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/distinct/DistinctBy.kt b/idea/testData/debugger/sequence/exec/collection/src/distinct/DistinctBy.kt new file mode 100644 index 00000000000..e27e797013b --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/distinct/DistinctBy.kt @@ -0,0 +1,6 @@ +package distinct + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2, 3, 4, 5).distinctBy { it % 2 } +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/filter/Filter.kt b/idea/testData/debugger/sequence/exec/collection/src/filter/Filter.kt new file mode 100644 index 00000000000..e2c6b6aeda3 --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/filter/Filter.kt @@ -0,0 +1,6 @@ +package filter + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2).filter { it % 2 == 0 } +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/final/Average.kt b/idea/testData/debugger/sequence/exec/collection/src/final/Average.kt new file mode 100644 index 00000000000..3f86f1f2097 --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/final/Average.kt @@ -0,0 +1,6 @@ +package final + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2, 3, 4).average() +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/flatMap/FlatMap.kt b/idea/testData/debugger/sequence/exec/collection/src/flatMap/FlatMap.kt new file mode 100644 index 00000000000..a19504d009d --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/flatMap/FlatMap.kt @@ -0,0 +1,6 @@ +package flatMap + +fun main(args: Array) { + // Breakpoint! + listOf(2, 3).flatMap { 0..it } +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/grouping/GroupBy.kt b/idea/testData/debugger/sequence/exec/collection/src/grouping/GroupBy.kt new file mode 100644 index 00000000000..1dec4043db1 --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/grouping/GroupBy.kt @@ -0,0 +1,6 @@ +package grouping + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2, 3, 4, 5).groupBy { it % 2 } +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/map/Map.kt b/idea/testData/debugger/sequence/exec/collection/src/map/Map.kt new file mode 100644 index 00000000000..a1a254d7fcd --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/map/Map.kt @@ -0,0 +1,6 @@ +package map + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2).map { it * it } +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/map/MapToSameCollection.kt b/idea/testData/debugger/sequence/exec/collection/src/map/MapToSameCollection.kt new file mode 100644 index 00000000000..d39fc137730 --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/map/MapToSameCollection.kt @@ -0,0 +1,8 @@ +package map + +fun main(args: Array) { + val dst = mutableListOf(1, 2, 3) + // Breakpoint! + listOf(4, 5, 6).mapTo(dst, { it * it }).filter { it % 4 != 0 }.mapTo(dst, { it * it }) + println(dst) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/misc/IndexOf.kt b/idea/testData/debugger/sequence/exec/collection/src/misc/IndexOf.kt new file mode 100644 index 00000000000..5ebbaf99d4c --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/misc/IndexOf.kt @@ -0,0 +1,6 @@ +package misc + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2).indexOf(2) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithGreater.kt b/idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithGreater.kt new file mode 100644 index 00000000000..b4094a0d580 --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithGreater.kt @@ -0,0 +1,6 @@ +package zip + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2).zip(listOf(1, 4, 8)) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithLesser.kt b/idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithLesser.kt new file mode 100644 index 00000000000..c5d2de448b7 --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithLesser.kt @@ -0,0 +1,6 @@ +package zip + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2, 3).zip(listOf(1, 4)) +} \ No newline at end of file diff --git a/idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithSame.kt b/idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithSame.kt new file mode 100644 index 00000000000..447d4a057d0 --- /dev/null +++ b/idea/testData/debugger/sequence/exec/collection/src/zip/ZipWithSame.kt @@ -0,0 +1,6 @@ +package zip + +fun main(args: Array) { + // Breakpoint! + listOf(1, 2, 3).zip(listOf(1, 4, 8)) +} \ No newline at end of file diff --git a/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/ChecksTest.kt b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/ChecksTest.kt new file mode 100644 index 00000000000..a74de903d76 --- /dev/null +++ b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/ChecksTest.kt @@ -0,0 +1,14 @@ +package com.intellij.debugger.streams.kotlin.exec.collection + +/** + * @author Vitaliy.Bibaev + */ +class ChecksTest : CollectionTestCase("checks") { + fun testAllMatchFalse() { + doTestWithResult() + } + + fun testAllMatchTrue() { + doTestWithResult() + } +} \ No newline at end of file diff --git a/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/CollectionTestCase.kt b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/CollectionTestCase.kt new file mode 100644 index 00000000000..61d1653950b --- /dev/null +++ b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/CollectionTestCase.kt @@ -0,0 +1,17 @@ +package com.intellij.debugger.streams.kotlin.exec.collection + +import com.intellij.debugger.streams.kotlin.exec.KotlinTraceEvaluationTestCase +import com.intellij.debugger.streams.kotlin.lib.KotlinCollectionSupportProvider +import com.intellij.debugger.streams.lib.LibrarySupportProvider + +/** + * @author Vitaliy.Bibaev + */ +abstract class CollectionTestCase(private val packageName: String) : KotlinTraceEvaluationTestCase() { + override val appName: String = "collection" + override val librarySupport: LibrarySupportProvider = KotlinCollectionSupportProvider() + + override fun createLocalProcess(className: String) = super.createLocalProcess("$packageName.$className") + + protected fun doTestWithResult() = doTest(false) +} diff --git a/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/DistinctOperationsTest.kt b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/DistinctOperationsTest.kt new file mode 100644 index 00000000000..39b58f19e4b --- /dev/null +++ b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/DistinctOperationsTest.kt @@ -0,0 +1,14 @@ +package com.intellij.debugger.streams.kotlin.exec.collection + +/** + * @author Vitaliy.Bibaev + */ +class DistinctOperationsTest : CollectionTestCase("distinct") { + fun testDistinct() { + doTestWithResult() + } + + fun testDistinctBy() { + doTestWithResult() + } +} \ No newline at end of file diff --git a/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FilterOperationsTest.kt b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FilterOperationsTest.kt new file mode 100644 index 00000000000..bc563a1a604 --- /dev/null +++ b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FilterOperationsTest.kt @@ -0,0 +1,10 @@ +package com.intellij.debugger.streams.kotlin.exec.collection + +/** + * @author Vitaliy.Bibaev + */ +class FilterOperationsTest : CollectionTestCase("filter") { + fun testFilter() { + doTestWithResult() + } +} \ No newline at end of file diff --git a/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FinalOperationsTest.kt b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FinalOperationsTest.kt new file mode 100644 index 00000000000..26c4bad7bba --- /dev/null +++ b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FinalOperationsTest.kt @@ -0,0 +1,10 @@ +package com.intellij.debugger.streams.kotlin.exec.collection + +/** + * @author Vitaliy.Bibaev + */ +class FinalOperationsTest : CollectionTestCase("final") { + fun testAverage() { + doTestWithResult() + } +} \ No newline at end of file diff --git a/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FlatMapOperationsTest.kt b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FlatMapOperationsTest.kt new file mode 100644 index 00000000000..2d37b48e7e5 --- /dev/null +++ b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/FlatMapOperationsTest.kt @@ -0,0 +1,10 @@ +package com.intellij.debugger.streams.kotlin.exec.collection + +/** + * @author Vitaliy.Bibaev + */ +class FlatMapOperationsTest : CollectionTestCase("flatMap") { + fun testFlatMap() { + doTestWithResult() + } +} \ No newline at end of file diff --git a/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/GroupingOperationsTest.kt b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/GroupingOperationsTest.kt new file mode 100644 index 00000000000..278c877ad42 --- /dev/null +++ b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/GroupingOperationsTest.kt @@ -0,0 +1,10 @@ +package com.intellij.debugger.streams.kotlin.exec.collection + +/** + * @author Vitaliy.Bibaev + */ +class GroupingOperationsTest : CollectionTestCase("grouping") { + fun testGroupBy() { + doTestWithResult() + } +} \ No newline at end of file diff --git a/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/MapOperationsTest.kt b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/MapOperationsTest.kt new file mode 100644 index 00000000000..f7e760f4b8a --- /dev/null +++ b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/MapOperationsTest.kt @@ -0,0 +1,14 @@ +package com.intellij.debugger.streams.kotlin.exec.collection + +/** + * @author Vitaliy.Bibaev + */ +class MapOperationsTest : CollectionTestCase("map") { + fun testMap() { + doTestWithResult() + } + + fun testMapToSameCollection() { + doTestWithResult() + } +} \ No newline at end of file diff --git a/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/MiscOperationsTest.kt b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/MiscOperationsTest.kt new file mode 100644 index 00000000000..a3a90da65fa --- /dev/null +++ b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/MiscOperationsTest.kt @@ -0,0 +1,10 @@ +package com.intellij.debugger.streams.kotlin.exec.collection + +/** + * @author Vitaliy.Bibaev + */ +class MiscOperationsTest : CollectionTestCase("misc") { + fun testIndexOf() { + doTestWithResult() + } +} \ No newline at end of file diff --git a/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/ZipOperationsTest.kt b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/ZipOperationsTest.kt new file mode 100644 index 00000000000..befbc9bf215 --- /dev/null +++ b/idea/tests/com/intellij/debugger/streams/kotlin/exec/collection/ZipOperationsTest.kt @@ -0,0 +1,18 @@ +package com.intellij.debugger.streams.kotlin.exec.collection + +/** + * @author Vitaliy.Bibaev + */ +class ZipOperationsTest : CollectionTestCase("zip") { + fun testZipWithSame() { + doTestWithResult() + } + + fun testZipWithGreater() { + doTestWithResult() + } + + fun testZipWithLesser() { + doTestWithResult() + } +} \ No newline at end of file