2021-05-20 22:05:57 +08:00
|
|
|
|
2021-05-22 21:27:40 +08:00
|
|
|
## Function Tests.
|
2021-05-20 22:05:57 +08:00
|
|
|
|
2021-05-22 21:27:40 +08:00
|
|
|
def f1 return 'f1' end assert(f1() == 'f1')
|
|
|
|
def f2() return 'f2' end assert(f2() == 'f2')
|
|
|
|
def f3(a, b, c, d) return c end
|
2021-05-20 22:05:57 +08:00
|
|
|
assert(f3('a', 'b', 'c', 'd') == 'c')
|
|
|
|
|
2022-04-12 18:30:42 +08:00
|
|
|
## Local variables of inner funcions.
|
|
|
|
def f4
|
|
|
|
l1 = 3.14
|
2022-04-17 09:29:18 +08:00
|
|
|
f5 = function
|
2022-04-12 18:30:42 +08:00
|
|
|
l2 = 42
|
|
|
|
return l2
|
|
|
|
end
|
|
|
|
assert(f5() == 42)
|
|
|
|
end
|
|
|
|
f4()
|
2021-06-16 02:54:30 +08:00
|
|
|
|
|
|
|
# If we got here, that means all test were passed.
|
|
|
|
print('All TESTS PASSED')
|