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

Function TestLoadStringSyntaxError

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

Source from the content-addressed store, hash-verified

21}
22
23func TestLoadStringSyntaxError(t *testing.T) {
24 l := NewState()
25 err := LoadString(l, "this_is_a_syntax_error")
26 if err != SyntaxError {
27 t.Error("didn't return SyntaxError on string with syntax error")
28 }
29 if l.Top() != 1 {
30 t.Error("didn't push anything to the stack")
31 }
32 if l.IsString(-1) != true {
33 t.Error("didn't push a string to the stack")
34 }
35 estr, _ := l.ToString(-1)
36 if estr != "[string \"this_is_a_syntax_error\"]:1: syntax error near <eof>" {
37 t.Error("didn't push the correct error string")
38 }
39}

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected