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-02-28T13·28+0200
committertazjin <mail@tazj.in>2021-02-28T14·36+0000
commit2d9456d2474116d9a42213f692b13821eb28de81 (patch)
tree38dfd4cda140ad63f0f00185d4f80605905f49ad /users/tazjin/rlox/src/bytecode/tests.rs
parent47ffa8071152bcafb4b6ff87a3142bf12dbce12b (diff)
feat(tazjin/rlox): Implement unary negation operator r/2253
Change-Id: I9a5bd3581d4ed05371651697ec496341eb7971ae
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2572
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.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/users/tazjin/rlox/src/bytecode/tests.rs b/users/tazjin/rlox/src/bytecode/tests.rs
index d9a752b38788..d02f021ff0fd 100644
--- a/users/tazjin/rlox/src/bytecode/tests.rs
+++ b/users/tazjin/rlox/src/bytecode/tests.rs
@@ -58,3 +58,12 @@ fn trivial_literals() {
     expect("false", Value::Bool(false));
     expect("nil", Value::Nil);
 }
+
+#[test]
+fn negation() {
+    expect("!true", Value::Bool(false));
+    expect("!false", Value::Bool(true));
+    expect("!nil", Value::Bool(true));
+    expect("!13.5", Value::Bool(false));
+    expect("!-42", Value::Bool(false));
+}