go-vise

Constrained Size Output Virtual Machine
Info | Log | Files | Refs | README | LICENSE

commit 75ed8fb5124f03ad661607f401c601766fbdd4d1
parent 4915890910e1b50535b0b11421ecd6d2950007d5
Author: lash <dev@holbrook.no>
Date:   Tue,  2 May 2023 21:10:23 +0100

Reverse wrong order of next and previous menu entries

Diffstat:
Masm/asm_test.go | 16++++++++++++++++
Mvm/runner.go | 4++--
2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/asm/asm_test.go b/asm/asm_test.go @@ -75,6 +75,22 @@ func TestParserRoute(t *testing.T) { } b = bytes.NewBuffer(nil) + s = "MNEXT inky 12\n" + Parse(s, b) + expect = vm.NewLine(nil, vm.MNEXT, []string{"inky", "12"}, nil, nil) + if !bytes.Equal(b.Bytes(), expect) { + log.Fatalf("expected:\n\t%x\ngot:\n\t%x\n", expect, b) + } + + b = bytes.NewBuffer(nil) + s = "MPREV pinky 34\n" + Parse(s, b) + expect = vm.NewLine(nil, vm.MPREV, []string{"pinky", "34"}, nil, nil) + if !bytes.Equal(b.Bytes(), expect) { + log.Fatalf("expected:\n\t%x\ngot:\n\t%x\n", expect, b) + } + + b = bytes.NewBuffer(nil) s = "INCMP foo bar\n" Parse(s, b) expect = vm.NewLine(nil, vm.INCMP, []string{"foo", "bar"}, nil, nil) diff --git a/vm/runner.go b/vm/runner.go @@ -429,7 +429,7 @@ func(vm *Vm) runMOut(ctx context.Context, b []byte) ([]byte, error) { // executes the MNEXT opcode func(vm *Vm) runMNext(ctx context.Context, b []byte) ([]byte, error) { - selector, display, b, err := ParseMNext(b) + display, selector, b, err := ParseMNext(b) if err != nil { return b, err } @@ -443,7 +443,7 @@ func(vm *Vm) runMNext(ctx context.Context, b []byte) ([]byte, error) { // executes the MPREV opcode func(vm *Vm) runMPrev(ctx context.Context, b []byte) ([]byte, error) { - selector, display, b, err := ParseMPrev(b) + display, selector, b, err := ParseMPrev(b) if err != nil { return b, err }