feat(tazjin/rlox): Implement unary negation operator

Change-Id: I9a5bd3581d4ed05371651697ec496341eb7971ae
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2572
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2021-02-28 15:28:04 +02:00 committed by tazjin
parent 47ffa80711
commit 2d9456d247
5 changed files with 32 additions and 0 deletions

View file

@ -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));
}