The Sol Programming Language!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
468 B

execfile("tests/_lib.sol")
func count(v, c=0, lv=0)
c += 1
lv = v
end
d = {method = count}
d:method()
assert_eq(d, count.closure.lv, "method called with self")
assert_eq(1, count.closure.c, "method evaluated once (expr is map)")
func count(c = 0)
c += 1
return {v = c, method = func(self) return self.v end}
end
assert_eq(count():method(), count.closure.c, "method evaluation consistent")
assert_eq(1, count.closure.c, "method evaluated once (expr is call)")