MCPcopy Index your code
hub / github.com/Shopify/go-lua / TestLocIsCorrectOnError

Function TestLocIsCorrectOnError

vm_test.go:444–460  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

442}
443
444func TestLocIsCorrectOnError(t *testing.T) {
445 l := NewState()
446 if err := l.Load(strings.NewReader(`
447 a = 3 - 3
448 b = 3 / q -- line 3; errs!
449 `), "test", ""); err != nil {
450 t.Errorf("Unexpected error! Got %v", err)
451 }
452 err := l.ProtectedCall(0, 0, 0)
453 if err == nil {
454 t.Errorf("Expected error! Got none... :(")
455 } else {
456 if err.Error() != "runtime error: [string \"test\"]:3: attempt to perform arithmetic on a nil value" {
457 t.Errorf("Wrong error reported: %v", err)
458 }
459 }
460}

Callers

nothing calls this directly

Calls 4

LoadMethod · 0.95
ProtectedCallMethod · 0.95
NewStateFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected