ChaiScript/unittests/object_constructor_guards.chai
2011-09-24 12:05:08 -06:00

11 lines
278 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(); }
auto b = bob(12)
auto c = bob(3)
assert_equal("Any Other Value: 12", b.val )
assert_equal("Less Than Ten: 3", c.val )