MCPcopy Index your code
hub / github.com/yuin/gopher-lua / TestLoadFileForShebang

Function TestLoadFileForShebang

auxlib_test.go:301–320  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

299}
300
301func TestLoadFileForShebang(t *testing.T) {
302 tmpFile, err := os.CreateTemp("", "")
303 errorIfNotNil(t, err)
304
305 err = os.WriteFile(tmpFile.Name(), []byte(`#!/path/to/lua
306print("hello")
307`), 0644)
308 errorIfNotNil(t, err)
309
310 defer func() {
311 tmpFile.Close()
312 os.Remove(tmpFile.Name())
313 }()
314
315 L := NewState()
316 defer L.Close()
317
318 _, err = L.LoadFile(tmpFile.Name())
319 errorIfNotNil(t, err)
320}
321
322func TestLoadFileForEmptyFile(t *testing.T) {
323 tmpFile, err := os.CreateTemp("", "")

Callers

nothing calls this directly

Calls 6

errorIfNotNilFunction · 0.85
NameMethod · 0.80
LoadFileMethod · 0.80
NewStateFunction · 0.70
CloseMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…