summaryrefslogtreecommitdiff
path: root/Examples/test-suite/lua/cpp_basic_runme.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/test-suite/lua/cpp_basic_runme.lua')
-rw-r--r--Examples/test-suite/lua/cpp_basic_runme.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/Examples/test-suite/lua/cpp_basic_runme.lua b/Examples/test-suite/lua/cpp_basic_runme.lua
index c7e0325c5..5a0e1c699 100644
--- a/Examples/test-suite/lua/cpp_basic_runme.lua
+++ b/Examples/test-suite/lua/cpp_basic_runme.lua
@@ -86,3 +86,14 @@ f4_name = tostring(f4)
assert( f2_name == "Foo" )
assert( f3_name == "Foo" )
assert( f4_name == "FooSubSub" )
+
+-- Test __eq implementation supplied by default
+
+-- eq_f1 and eq_f2 must be different userdata with same Foo* pointer. If eq_f1 and eq_f2 are the same userdata (e.g.)
+-- > eq_f1 = smth
+-- > eq_f2 = eq_f1
+-- then default Lua equality comparison kicks in and considers them equal. Access to global_fptr is actually a
+-- function call (internally) and it returns new userdata each time.
+eq_f1 = cb.Bar.global_fptr
+eq_f2 = cb.Bar.global_fptr
+assert( eq_f1 == eq_f2 )