Add test for if

This commit is contained in:
Laria 2022-10-31 15:50:51 +01:00
parent 0836b8c97c
commit 18ae382414
2 changed files with 40 additions and 0 deletions

View file

@ -63,6 +63,7 @@ functionaltest("mathops")
functionaltest("len")
functionaltest("not")
functionaltest("type")
functionaltest("if")
install(TARGETS apfl DESTINATION lib)
install(TARGETS apfl-bin DESTINATION bin)

View file

@ -0,0 +1,39 @@
===== script =====
i = 1
if (== i 1) {
print "1: ok"
}
if (not (== i 1)) {
print "2: fail"
} {
print "2: ok"
}
if false {
print "3: fail"
} nil {
print "3: fail"
} {
print "3: ok"
}
print (if true {
"4: ok"
} {
"4: fail"
})
if false {
print "5: fail"
} nil {
print "5: fail"
} (== 1 2) {
print "5: fail"
}
===== output =====
1: ok
2: ok
3: ok
4: ok