(t *testing.T, L *LState, script string, pattern string)
| 54 | } |
| 55 | |
| 56 | func 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 | |
| 68 | func errorIfGFuncNotFail(t *testing.T, L *LState, f LGFunction, pattern string) { |
| 69 | if err := L.GPCall(f, LNil); err != nil { |
no test coverage detected
searching dependent graphs…