diff options
Diffstat (limited to 'users/tazjin')
-rw-r--r-- | users/tazjin/rlox/src/bytecode/tests.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/users/tazjin/rlox/src/bytecode/tests.rs b/users/tazjin/rlox/src/bytecode/tests.rs index 9b31d5469be1..b29769f460a1 100644 --- a/users/tazjin/rlox/src/bytecode/tests.rs +++ b/users/tazjin/rlox/src/bytecode/tests.rs @@ -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"); +} |