pocketlang/tests/lang/functions.pk

22 lines
395 B
Plaintext
Raw Normal View History

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')
## Local variables of inner funcions.
def f4
l1 = 3.14
f5 = function
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')