test(tazjin/rlox): Add simple string assertions

Change-Id: I6c60934d57170157d877e71cc87a97ab773342b5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2581
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2021-03-02 13:10:49 +02:00 committed by tazjin
parent 851e32cfe7
commit bcea8e0d16

View file

@ -18,6 +18,10 @@ fn expect_bool(code: &str, value: bool) {
expect(code, Value::Bool(value))
}
fn expect_str(code: &str, value: &str) {
expect(code, Value::String(value.to_string().into()))
}
#[test]
fn numbers() {
expect_num("1", 1.0);
@ -98,3 +102,9 @@ fn comparisons() {
expect_bool("42 >= 42", true);
expect_bool("42 >= 23", true);
}
#[test]
fn strings() {
expect_str("\"hello\"", "hello");
expect_str("\"hello\" + \" world\"", "hello world");
}