zxul767 / lox

An interpreter for the Lox language
1 stars 0 forks source link

add `assert` to the language #26

Open zxul767 opened 1 year ago

zxul767 commented 1 year ago

it would be very useful to have an assert function in the standard library, which can serve as a poor man's testing facility (e.g., see pytest):

assert("hello".starts_with("hell"), "starts_with failed!")
assert("hello".ends_with("llo"), "ends_with failed!")