ChaiScript/unittests/3.x/object_constructor_guards.chai
Jonathan Turner c73f16fdfe Fixing 4.x grammar to be backward compatible.
Added 3.x unit tests back to show this.
2012-05-17 10:14:50 -07:00

11 lines
276 B
ChaiScript

attr bob::val
def bob::bob(x) : x < 10 { this.val = "Less Than Ten: " + x.to_string(); }
def bob::bob(x) { this.val = "Any Other Value: " + x.to_string(); }
var b = bob(12)
var c = bob(3)
assert_equal("Any Other Value: 12", b.val )
assert_equal("Less Than Ten: 3", c.val )