MCPcopy Create free account
hub / github.com/yuin/gopher-lua / TestCheckOption

Function TestCheckOption

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

Source from the content-addressed store, hash-verified

157}
158
159func TestCheckOption(t *testing.T) {
160 opts := []string{
161 "opt1",
162 "opt2",
163 "opt3",
164 }
165 L := NewState()
166 defer L.Close()
167 errorIfGFuncNotFail(t, L, func(L *LState) int {
168 L.Push(LString("opt1"))
169 errorIfNotEqual(t, 0, L.CheckOption(2, opts))
170 L.Push(LString("opt5"))
171 L.CheckOption(3, opts)
172 return 0
173 }, "invalid option: opt5 \\(must be one of opt1,opt2,opt3\\)")
174}
175
176func TestOptInt(t *testing.T) {
177 L := NewState()

Callers

nothing calls this directly

Calls 7

errorIfGFuncNotFailFunction · 0.85
LStringTypeAlias · 0.85
errorIfNotEqualFunction · 0.85
CheckOptionMethod · 0.80
NewStateFunction · 0.70
PushMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…