Intention to transform an if an AssertionError throw into an assert

This commit is contained in:
Tal Man
2014-04-20 11:47:50 -04:00
committed by Zalim Bashorov
parent d06b9abd4f
commit f61db2decc
30 changed files with 348 additions and 5 deletions
@@ -0,0 +1,8 @@
// WITH_RUNTIME
fun foo() {
if <caret>(true) {
throw AssertionError("text")
}
}
fun assert(x: Boolean, y: Any) {}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
kotlin.assert(!true, "text")
}
fun assert(x: Boolean, y: Any) {}
@@ -0,0 +1,10 @@
// WITH_RUNTIME
package foo.kotlin
fun foo() {
if <caret>(true) {
throw AssertionError("text")
}
}
fun assert(x: Boolean, y: Any) {}
@@ -0,0 +1,8 @@
// WITH_RUNTIME
package foo.kotlin
fun foo() {
kotlin.assert(!true, "text")
}
fun assert(x: Boolean, y: Any) {}
@@ -0,0 +1,7 @@
// WITH_RUNTIME
fun foo() {
val x = true
if <caret>(x && false) {
throw AssertionError("text")
}
}
@@ -0,0 +1,5 @@
// WITH_RUNTIME
fun foo() {
val x = true
assert(!(x && false), "text")
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
if <caret>(true) {
throw java.lang.AssertionError("text")
}
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun foo() {
assert(!true, "text")
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun foo() {
if <caret>(1 == 0) {
throw AssertionError("text")
}
}
class AssertionError(x: String): Exception(x) {}
@@ -0,0 +1,7 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun foo() {
if <caret>(1 == 0) {
throw AssertionError("text", Exception())
}
}
@@ -0,0 +1,9 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun foo() {
if <caret>(1 == 0) {
throw AssertionError("text")
} else {
val x = 1
}
}
@@ -0,0 +1,8 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun foo() {
if <caret>(1 == 0) {
val y = 1
throw AssertionError("text")
}
}
@@ -0,0 +1,8 @@
// IS_APPLICABLE: false
// WITH_RUNTIME
fun foo() {
if <caret>(1 == 0) {
throw AssertionError("text")
val y = 1
}
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
if <caret>(true) {
throw AssertionError()
}
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun foo() {
assert(!true)
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
if <caret>(true) {
throw AssertionError(null)
}
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun foo() {
assert(!true)
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
if <caret>(true) {
throw AssertionError("text")
}
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun foo() {
assert(!true, "text")
}
@@ -0,0 +1,6 @@
// WITH_RUNTIME
fun foo() {
if <caret>(1 == 0) {
throw AssertionError("text")
}
}
@@ -0,0 +1,4 @@
// WITH_RUNTIME
fun foo() {
assert(1 != 0, "text")
}