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

Function TestUserDataEqualityNil

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

Source from the content-addressed store, hash-verified

248}
249
250func TestUserDataEqualityNil(t *testing.T) {
251 const s = `return function(x)
252 local b = x == nil
253 assert(type(b) == "boolean")
254 assert(b == false)
255 end`
256
257 l := NewState()
258 OpenLibraries(l)
259 LoadString(l, s)
260 if err := l.ProtectedCall(0, 1, 0); err != nil {
261 t.Error(err.Error())
262 }
263
264 l.PushUserData(5)
265 if err := l.ProtectedCall(1, 0, 0); err != nil {
266 t.Error(err.Error())
267 }
268}
269
270func TestTableEqualityNil(t *testing.T) {
271 const s = `local b = {} == nil

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