Stdlib: fix signature of Reader.forEachLine() function

#KT-4242 Fixed
This commit is contained in:
Pavel V. Talanov
2014-01-09 16:28:51 +04:00
parent 66c7e89f57
commit 7db53106fd
2 changed files with 11 additions and 12 deletions
+8 -2
View File
@@ -52,7 +52,6 @@ class IoTest(){
test fun testForEachLine() {
val list = ArrayList<String>()
val reader = sample()
/* TODO would be nicer maybe to write this as
reader.lines.forEach { ... }
@@ -65,11 +64,18 @@ class IoTest(){
if thing is not an Iterable/array/Iterator but has a suitable forEach method
*/
reader.forEachLine{
sample().forEachLine {
list.add(it)
}
assertEquals(arrayListOf("Hello", "World"), list)
var count = 0
sample().forEachLine {
count += 1
}
assertEquals(2, count)
}
test fun testForEachLineFile() {