diff --git a/src/build/opcode/test.rs b/src/build/opcode/test.rs index 278431e..09b1a87 100644 --- a/src/build/opcode/test.rs +++ b/src/build/opcode/test.rs @@ -16,7 +16,8 @@ use super::scope::Stack; use super::Composite::{List, Tuple}; use super::Op::{ Add, Bang, Bind, Cp, DeRef, Div, Element, Equal, FCall, Field, Func, InitList, InitThunk, - InitTuple, Jump, JumpIfFalse, JumpIfTrue, Module, Mul, Noop, Return, SelectJump, Sub, Sym, Val, + InitTuple, Jump, JumpIfFalse, JumpIfTrue, Module, Mul, Noop, Pop, Return, SelectJump, Sub, Sym, + Val, }; use super::Primitive::{Bool, Float, Int, Str}; use super::Value::{C, P}; @@ -411,8 +412,22 @@ fn test_select_short_circuit() { Sym("field".to_owned()), // 5 // second field to compare SelectJump(2), // 6 Val(Int(1)), // 7 // expression for second field + Jump(2), // 8 + Pop, // 9 // pop the search field off + Bang, // 10 // default case + ] => P(Int(1)), + vec![ + Sym("field".to_owned()), // 0 // search field + Sym("not_field".to_owned()), // 1 // first field to compare + SelectJump(2), // 2 + Val(Str("not our value".to_owned())), // 3 // expression for first field + Jump(4), // 4 + Sym("als not field".to_owned()), // 5 // second field to compare + SelectJump(2), // 6 + Val(Int(1)), // 7 // expression for second field Jump(1), // 8 - Bang, // 9 // default case + Pop, // 9 // pop the search field off + Val(Int(1)), // 10 // default case ] => P(Int(1)), ]; }