JS: create new common directory for all generated tests, migrate several tests there

This commit is contained in:
Alexey Andreev
2016-08-26 16:44:48 +03:00
parent 34a57f863b
commit 2bf0199959
321 changed files with 2123 additions and 2001 deletions
@@ -0,0 +1,34 @@
package foo
class SimpleEnumerator {
private var counter = 0
fun getNext(): String {
counter++;
return counter.toString()
}
fun hasMoreElements(): Boolean = counter < 1
}
class SimpleEnumeratorWrapper(private val enumerator: SimpleEnumerator) {
operator fun hasNext(): Boolean = enumerator.hasMoreElements()
operator fun next() = enumerator.getNext()
}
operator fun SimpleEnumerator.iterator(): SimpleEnumeratorWrapper {
return SimpleEnumeratorWrapper(this)
}
fun box(): String {
var o = ""
val enumerator = SimpleEnumerator()
for (s in enumerator) {
o += s;
}
if (o != "1") return "fail: $o"
return "OK"
}