Minor: verify exception type of failed fold/reduce
This commit is contained in:
@@ -223,11 +223,9 @@ class CollectionTest {
|
|||||||
list.reduceIndexed { index, a, b -> if (index == 3) a else a + b }
|
list.reduceIndexed { index, a, b -> if (index == 3) a else a + b }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO replace with more accurate version when KT-5987 will be fixed
|
assertTrue(assertFails {
|
||||||
// failsWith(javaClass<UnsupportedOperationException>()) {
|
arrayListOf<Int>().reduceIndexed { index, a, b -> a + b }
|
||||||
assertFails {
|
} is UnsupportedOperationException)
|
||||||
run { arrayListOf<Int>().reduceIndexed { index, a, b -> a + b } }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test fun reduceRightIndexed() {
|
@test fun reduceRightIndexed() {
|
||||||
@@ -236,11 +234,9 @@ class CollectionTest {
|
|||||||
list.reduceRightIndexed { index, a, b -> if (index == 0) b else a + b }
|
list.reduceRightIndexed { index, a, b -> if (index == 0) b else a + b }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO replace with more accurate version when KT-5987 will be fixed
|
assertTrue(assertFails {
|
||||||
// failsWith(javaClass<UnsupportedOperationException>()) {
|
arrayListOf<Int>().reduceRightIndexed { index, a, b -> a + b }
|
||||||
assertFails {
|
} is UnsupportedOperationException)
|
||||||
run { arrayListOf<Int>().reduceRightIndexed { index, a, b -> a + b } }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test fun reduce() {
|
@test fun reduce() {
|
||||||
@@ -249,11 +245,9 @@ class CollectionTest {
|
|||||||
list.reduce { a, b -> a + b }
|
list.reduce { a, b -> a + b }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO replace with more accurate version when KT-5987 will be fixed
|
assertTrue(assertFails {
|
||||||
// failsWith(javaClass<UnsupportedOperationException>()) {
|
arrayListOf<Int>().reduce { a, b -> a + b }
|
||||||
assertFails {
|
} is UnsupportedOperationException)
|
||||||
run { arrayListOf<Int>().reduce { a, b -> a + b } }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test fun reduceRight() {
|
@test fun reduceRight() {
|
||||||
@@ -262,11 +256,9 @@ class CollectionTest {
|
|||||||
list.reduceRight { a, b -> a + b }
|
list.reduceRight { a, b -> a + b }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO replace with more accurate version when KT-5987 will be fixed
|
assertTrue(assertFails {
|
||||||
// failsWith(javaClass<UnsupportedOperationException>()) {
|
arrayListOf<Int>().reduceRight { a, b -> a + b }
|
||||||
assertFails {
|
} is UnsupportedOperationException)
|
||||||
run { arrayListOf<Int>().reduceRight { a, b -> a + b } }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@test fun groupBy() {
|
@test fun groupBy() {
|
||||||
|
|||||||
Reference in New Issue
Block a user