about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/bytecode/tests.rs
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-03-02T11·10+0200
committertazjin <mail@tazj.in>2021-03-02T19·48+0000
commitbcea8e0d169974ba57a54ca098f480d6294a7fb1 (patch)
treecd61c16f22c369c640346a343cb897009ae7a0db /users/tazjin/rlox/src/bytecode/tests.rs
parent851e32cfe759b553c75be02bc9c04ce7eeef8286 (diff)
test(tazjin/rlox): Add simple string assertions r/2262
Change-Id: I6c60934d57170157d877e71cc87a97ab773342b5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2581
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/tazjin/rlox/src/bytecode/tests.rs')
-rw-r--r--users/tazjin/rlox/src/bytecode/tests.rs10
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");
+}