[JS IR] Add infra to test compilation with error

- add bunch of tests
 - fix help test
This commit is contained in:
Roman Artemev
2020-09-01 12:04:15 +03:00
parent e592b3af1d
commit 0bff406a12
19 changed files with 460 additions and 13 deletions
@@ -0,0 +1,16 @@
// ERROR_POLICY: SYNTAX
// FILE: t.kt
fun foo() { this->bar() }
// FILE: b.kt
fun box(): String {
try {
foo()
} catch (e: IllegalStateException) {
return "OK"
}
return "FAIL"
}
@@ -0,0 +1,33 @@
// ERROR_POLICY: SYNTAX
// FILE: t.kt
fun bar(aa: Any, bb: Any, cc: Any) {
<<;;;;;
d8as9d89as
??????? ====----
}
fun foo() {
bar(a(), b(), c())
<<<<<,,,,>>>>>
f()
}
fun a(): Any { storage += "a"; return storage }
fun b(): Any { storage += "b"; return storage }
fun c(): Any { storage += "c"; return storage }
fun f(): Any { storage += "FAIL"; return storage }
var storage = ""
// FILE: b.kt
fun box(): String {
try {
foo()
} catch (e: IllegalStateException) {
return if (storage == "abc") "OK" else "FAIL ABC"
return "FAIL"
}
@@ -0,0 +1,38 @@
// ERROR_POLICY: SYNTAX
// FILE: t.kt
384jfjfj2934829...:::%:ББББ
fun 124gga() {}
val 481gu: Boolean = true
var 981llj): Int = 42
// just check if it is compiled
class **jhghssk
fun foo() { 124gga() }
fun bar() { return 481gu }
fun qux() { 981llj) = 481 }
// FILE: b.kt
fun box(): String {
try {
foo()
} catch (e: IllegalStateException) {
try {
bar()
} catch (e: IllegalStateException) {
try {
qux()
} catch (e: IllegalStateException) {
return "OK"
}
}
}
return "FAIL"
}
@@ -0,0 +1,20 @@
// ERROR_POLICY: SYNTAX
// FILE: t.kt
1sdasf
fun bar() {}
fun foo() { bar(,,,,,,,) }
// FILE: b.kt
fun box(): String {
try {
foo()
} catch (e: IllegalStateException) {
return "OK"
}
return "FAIL"
}