(l *State, t *testing.T, source string)
| 65 | } |
| 66 | |
| 67 | func protectedTestParser(l *State, t *testing.T, source string) { |
| 68 | defer func() { |
| 69 | if x := recover(); x != nil { |
| 70 | t.Error(x) |
| 71 | t.Log(string(debug.Stack())) |
| 72 | } |
| 73 | }() |
| 74 | t.Log("Compiling " + source) |
| 75 | binary := strings.TrimSuffix(source, ".lua") + ".bin" |
| 76 | if err := exec.Command("luac", "-o", binary, source).Run(); err != nil { |
| 77 | t.Fatalf("luac failed to compile %s: %s", source, err) |
| 78 | } |
| 79 | t.Log("Parsing " + source) |
| 80 | bin := load(l, t, binary) |
| 81 | l.Pop(1) |
| 82 | src := load(l, t, source) |
| 83 | l.Pop(1) |
| 84 | t.Log(source) |
| 85 | compareClosures(t, src, bin) |
| 86 | } |
| 87 | |
| 88 | func expectEqual(t *testing.T, x, y interface{}, m string) { |
| 89 | if x != y { |
no test coverage detected