blob: fedda5e95b07660ec057b446775a3a93ed709d9f [file] [log] [blame]
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"
}
}
}