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-10-03T11·20+0300
committertazjin <mail@tazj.in>2021-10-19T12·58+0000
commitc318f42c119f3dd13bf0cfd7917bfdd41fea7085 (patch)
tree19ab277a770dc12fd0ca7b7615b3ba0df38723f8 /users/tazjin/rlox/src/bytecode/tests.rs
parentad7e591c8046d6e179476192ef9928d5fae78422 (diff)
feat(tazjin/rlox): Support local variables r/2978
WIP

Change-Id: I78fbc885faaac165c380cbd9aa98b4b64a9b8274
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3685
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'users/tazjin/rlox/src/bytecode/tests.rs')
-rw-r--r--users/tazjin/rlox/src/bytecode/tests.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/users/tazjin/rlox/src/bytecode/tests.rs b/users/tazjin/rlox/src/bytecode/tests.rs
index 13e64400ade5..de482275ecfd 100644
--- a/users/tazjin/rlox/src/bytecode/tests.rs
+++ b/users/tazjin/rlox/src/bytecode/tests.rs
@@ -128,6 +128,23 @@ fn global_assignment() {
           breakfast = "beignets with " + beverage;
           breakfast;
         "#,
-        "beignets with cafe au lait"
+        "beignets with cafe au lait",
+    );
+}
+
+#[test]
+fn local_variables() {
+    expect_num(
+        r#"
+          var a = 10;
+          var b = 5;
+
+          {
+            var b = 10;
+            var c = 2;
+            a * b * c;
+          }
+        "#,
+        200.0,
     );
 }