mirror of
https://github.com/hanzoai/expr.git
synced 2026-09-24 16:58:58 +00:00
21 lines
385 B
Go
21 lines
385 B
Go
package vm_test
|
|
|
|
import (
|
|
"github.com/antonmedv/expr/vm"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestProgram_Disassemble(t *testing.T) {
|
|
for op := vm.OpPush; op < vm.OpLoad; op++ {
|
|
program := vm.Program{
|
|
Constants: []interface{}{true},
|
|
Bytecode: []byte{op},
|
|
}
|
|
d := program.Disassemble()
|
|
if strings.Contains(d, "\t0x") {
|
|
t.Errorf("cannot disassemble opcode %#x", op)
|
|
}
|
|
}
|
|
}
|