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

Function TestTableUserdataEquality

vm_test.go:226–248  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

224}
225
226func TestTableUserdataEquality(t *testing.T) {
227 const s = `return function(x)
228 local b = x == {}
229 assert(type(b) == "boolean")
230 assert(b == false)
231 -- reverse
232 b = {} == x
233 assert(type(b) == "boolean")
234 assert(b == false)
235 end`
236
237 l := NewState()
238 OpenLibraries(l)
239 LoadString(l, s)
240 if err := l.ProtectedCall(0, 1, 0); err != nil {
241 t.Error(err.Error())
242 }
243
244 l.PushUserData(5)
245 if err := l.ProtectedCall(1, 0, 0); err != nil {
246 t.Error(err.Error())
247 }
248}
249
250func TestUserDataEqualityNil(t *testing.T) {
251 const s = `return function(x)

Callers

nothing calls this directly

Calls 6

ProtectedCallMethod · 0.95
PushUserDataMethod · 0.95
NewStateFunction · 0.85
OpenLibrariesFunction · 0.85
LoadStringFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected