%TestML 0.1.0
# %DumpAst 1
Plan = 21
Label = 'Fruity Tests'
{
Label = 'Anonymous function never called'
True == False
}
test1 = (f, c, t) {
List(f, '->', c).Join == t
t.Strip(f).Strip('->') == c
t.Strip('->') == List(f, c).Join
}
test1.Type == 'Func'
Label = '$BlockLabel'
test1(*fruit, *color, *thing)
test2 = (color, thing) {
thing ~~ color
}
test2(*color, *thing)
test3 = (a, b, c) {
f1(a) == b
f2(a) == c
}
test3(*input, *output1, *output2)
Label = 'Passing functions as objects'
test4 = (func, num) {
func.Type == 'Func'
func(num)
}
test5 = (num) {
num == 42
}
test4(test5, 42)
=== Red Apple
--- fruit: apple
--- color: red
--- thing: apple->red
=== Orange Orange
--- fruit: orange
--- color: orange
--- thing: orange->orange
=== Green Grape
--- fruit: grape
--- color: green
--- thing: grape->green
=== One
--- input: 1
--- output1: 43
--- output2: 2
=== Two
--- input: 2
--- output1: 86
--- output2: 6
=== Three
--- input: 5
--- output1: 215
--- output2: 30