blob: 3de971f77d92f8cf2e81c6e7a7bad0c35b316af0 [file] [log] [blame]
package groovy
class IfTest extends GroovyTestCase {
void testUsingNumber() {
def x = 1
if (x) {
println "${x} is true"
}
else {
fail("should not be false")
}
x = 0
if (x) {
fail("should not be true")
}
else {
println "${x} is false"
}
}
void testUsingString() {
def x = "abc"
if (x) {
println "${x} is true"
}
else {
fail("should not be false")
}
x = ""
if (x) {
fail("should not be true")
}
else {
println "${x} is false"
}
}
}