JS: support int overflow behaviour in augmented assignment

This commit is contained in:
Alexey Andreev
2016-12-07 15:03:46 +03:00
parent c411a8febe
commit eb5c79c70d
8 changed files with 71 additions and 14 deletions
@@ -3,13 +3,14 @@ import kotlin.test.*
var log = ""
var result = 20
var doubleResult = 40.0
fun <T> id(value: T) = value
fun box(): String {
result += if (id("true") == "true") {
result += 10
log += "true chosen"
log += "true chosen;"
3
}
else {
@@ -17,7 +18,18 @@ fun box(): String {
}
assertEquals(23, result)
assertEquals("true chosen", log)
doubleResult += if (id("true") == "true") {
doubleResult += 100
log += "true chosen;"
2
}
else {
5
}
assertEquals(42, (doubleResult + 0.1).toInt())
assertEquals("true chosen;true chosen;", log)
return "OK"
}