about summary refs log tree commit diff
path: root/users/tazjin/rlox/src/bytecode/tests.rs
diff options
context:
space:
mode:
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 b346da19810d..d5b6ab020389 100644
--- a/users/tazjin/rlox/src/bytecode/tests.rs
+++ b/users/tazjin/rlox/src/bytecode/tests.rs
@@ -108,3 +108,13 @@ fn strings() {
     expect_str("\"hello\";", "hello");
     expect_str("\"hello\" + \" world\";", "hello world");
 }
+
+#[test]
+fn variables() {
+    expect_num("var a = 5; a;", 5.0);
+    expect_num("var a = 5; var b = 2; a * b;", 10.0);
+    expect_str(
+        "var greeting = \"hello\"; var name = \"Zubnog\"; greeting + \" \" + name;",
+        "hello Zubnog",
+    );
+}