JS backend: fixed variable capturing in extension functions.
Fixed ClosureTest.testWrappedVariableInExtensionFun IteratorsTest.foldReducesTheFirstNElements and IteratorsTest.takeExtractsTheFirstNElements. All tests passed. (cherry picked from commit f8f1895)
This commit is contained in:
@@ -16,14 +16,12 @@ class IteratorsTest {
|
||||
assertEquals(arrayList(144, 233, 377, 610, 987), fibonacci().filter { it > 100 }.takeWhile { it < 1000 }.toList())
|
||||
}
|
||||
|
||||
// TODO fix and enable this test
|
||||
fun foldReducesTheFirstNElements() {
|
||||
test fun foldReducesTheFirstNElements() {
|
||||
val sum = { (a: Int, b: Int) -> a + b }
|
||||
assertEquals(arrayList(13, 21, 34, 55, 89).fold(0, sum), fibonacci().filter { it > 10 }.take(5).fold(0, sum))
|
||||
}
|
||||
|
||||
// TODO fix and enable this test
|
||||
fun takeExtractsTheFirstNElements() {
|
||||
test fun takeExtractsTheFirstNElements() {
|
||||
assertEquals(arrayList(0, 1, 1, 2, 3, 5, 8, 13, 21, 34), fibonacci().take(10).toList())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user