MCPcopy Index your code
hub / github.com/yuin/gopher-lua / errorIfScriptNotFail

Function errorIfScriptNotFail

testutils_test.go:56–66  ·  view source on GitHub ↗
(t *testing.T, L *LState, script string, pattern string)

Source from the content-addressed store, hash-verified

54}
55
56func errorIfScriptNotFail(t *testing.T, L *LState, script string, pattern string) {
57 if err := L.DoString(script); err != nil {
58 reg := regexp.MustCompile(pattern)
59 if len(reg.FindStringIndex(err.Error())) == 0 {
60 t.Errorf("%v error message '%v' does not contains given pattern string '%v'.", positionString(1), err.Error(), pattern)
61 return
62 }
63 return
64 }
65 t.Errorf("%v script should fail", positionString(1))
66}
67
68func errorIfGFuncNotFail(t *testing.T, L *LState, f LGFunction, pattern string) {
69 if err := L.GPCall(f, LNil); err != nil {

Callers 8

TestSkipOpenLibsFunction · 0.85
TestPCallFunction · 0.85
TestChannelSelectErrorFunction · 0.85
TestChannelSendReceive1Function · 0.85
TestCancelChannelReceiveFunction · 0.85

Calls 3

positionStringFunction · 0.85
DoStringMethod · 0.80
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…