Null my old friend

This commit is contained in:
Chuck Smith
2024-02-07 16:02:06 -05:00
parent 77401260a2
commit 6ba2d3abe4
5 changed files with 42 additions and 16 deletions

View File

@@ -182,17 +182,22 @@ func TestConditionals(t *testing.T) {
`,
expectedConstants: []interface{}{10, 3333},
expectedInstructions: []code.Instructions{
// 0000
code.Make(code.OpTrue),
// 0001
code.Make(code.OpJumpNotTruthy, 7),
code.Make(code.OpJumpNotTruthy, 10),
// 0004
code.Make(code.OpConstant, 0),
// 0007
code.Make(code.OpPop),
// 0008
code.Make(code.OpConstant, 1),
code.Make(code.OpJump, 11),
// 0010
code.Make(code.OpNull),
// 0011
code.Make(code.OpPop),
// 0012
code.Make(code.OpConstant, 1),
// 0015
code.Make(code.OpPop),
},
}, {
input: `