MCPcopy Create free account
hub / github.com/Shopify/go-lua / TestParser

Function TestParser

parser_test.go:19–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17}
18
19func TestParser(t *testing.T) {
20 l := NewState()
21 OpenLibraries(l)
22 bin := load(l, t, "fixtures/fib.bin")
23 l.Pop(1)
24 closure := load(l, t, "fixtures/fib.lua")
25 p := closure.prototype
26 if p == nil {
27 t.Fatal("prototype was nil")
28 }
29 validate("@fixtures/fib.lua", p.source, "as source file name", t)
30 if !p.isVarArg {
31 t.Error("expected main function to be var arg, but wasn't")
32 }
33 if len(closure.upValues) != len(closure.prototype.upValues) {
34 t.Error("upvalue count doesn't match", len(closure.upValues), "!=", len(closure.prototype.upValues))
35 }
36 compareClosures(t, bin, closure)
37 l.Call(0, 0)
38}
39
40func TestEmptyString(t *testing.T) {
41 l := NewState()

Callers

nothing calls this directly

Calls 8

PopMethod · 0.95
CallMethod · 0.95
NewStateFunction · 0.85
OpenLibrariesFunction · 0.85
loadFunction · 0.85
validateFunction · 0.85
compareClosuresFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…