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

Function TestLoadFileSyntaxError

auxiliary_test.go:5–21  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestLoadFileSyntaxError(t *testing.T) {
6 l := NewState()
7 err := LoadFile(l, "fixtures/syntax_error.lua", "")
8 if err != SyntaxError {
9 t.Error("didn't return SyntaxError on file with syntax error")
10 }
11 if l.Top() != 1 {
12 t.Error("didn't push anything to the stack")
13 }
14 if l.IsString(-1) != true {
15 t.Error("didn't push a string to the stack")
16 }
17 estr, _ := l.ToString(-1)
18 if estr != "fixtures/syntax_error.lua:4: syntax error near <eof>" {
19 t.Error("didn't push the correct error string")
20 }
21}
22
23func TestLoadStringSyntaxError(t *testing.T) {
24 l := NewState()

Callers

nothing calls this directly

Calls 6

TopMethod · 0.95
IsStringMethod · 0.95
ToStringMethod · 0.95
NewStateFunction · 0.85
LoadFileFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected