MCPcopy Index your code
hub / github.com/expr-lang/expr / TestVM_OpJump_NegativeOffset

Function TestVM_OpJump_NegativeOffset

vm/vm_test.go:1434–1463  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1432}
1433
1434func TestVM_OpJump_NegativeOffset(t *testing.T) {
1435 program := vm.NewProgram(
1436 file.Source{},
1437 nil,
1438 nil,
1439 0,
1440 nil,
1441 []vm.Opcode{
1442 vm.OpInt,
1443 vm.OpInt,
1444 vm.OpJump,
1445 vm.OpInt,
1446 vm.OpJump,
1447 },
1448 []int{
1449 1,
1450 2,
1451 -2, // negative offset for a forward jump opcode
1452 3,
1453 -2,
1454 },
1455 nil,
1456 nil,
1457 nil,
1458 )
1459
1460 _, err := vm.Run(program, nil)
1461 require.Error(t, err)
1462 require.Contains(t, err.Error(), "negative jump offset is invalid")
1463}
1464
1465func TestVM_StackUnderflow(t *testing.T) {
1466 tests := []struct {

Callers

nothing calls this directly

Calls 5

NewProgramFunction · 0.92
RunFunction · 0.92
ErrorFunction · 0.92
ContainsFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…