@@ -44,7 +44,7 @@ describe('GC', function()
44
44
assert .same ({ 1 , 2 , 3 }, res )
45
45
end )
46
46
47
- it (' returns an object that respons to pairs' , function ()
47
+ it (' returns an object that responds to pairs' , function ()
48
48
local test_table = { 1 , 2 , 3 , some_key = ' some_val' }
49
49
local test_metatable = { __gc = function () end }
50
50
@@ -58,7 +58,7 @@ describe('GC', function()
58
58
assert .same ({ [1 ] = 1 , [2 ] = 2 , [3 ] = 3 , some_key = ' some_val' }, res )
59
59
end )
60
60
61
- it (' returns an object that respects the __call in the mt of the original table ' , function ()
61
+ it (' returns an object that respects the __call in the mt passed in the params ' , function ()
62
62
local test_table = { 1 , 2 , 3 }
63
63
local test_metatable = {
64
64
__gc = function () end ,
@@ -78,7 +78,7 @@ describe('GC', function()
78
78
assert .equals (3 , table_with_gc (1 , 2 ))
79
79
end )
80
80
81
- it (' returns an object that respects the __tostring in the mt of the original table ' , function ()
81
+ it (' returns an object that respects the __tostring in the mt passed in the params ' , function ()
82
82
local test_table = { 1 , 2 , 3 }
83
83
local test_metatable = {
84
84
__gc = function () end ,
@@ -112,5 +112,16 @@ describe('GC', function()
112
112
113
113
assert .same (test_metatable , getmetatable (table_with_gc ))
114
114
end )
115
+
116
+ it (' returns an object that respects the __index in the mt passed in the params' , function ()
117
+ local test_table = { 1 , 2 , 3 }
118
+ local test_metatable = {
119
+ __gc = function () end ,
120
+ __index = { some_func = function () return ' abc' end }
121
+ }
122
+ local table_with_gc = GC .set_metatable_gc (test_table , test_metatable )
123
+
124
+ assert .equals (' abc' , table_with_gc :some_func ())
125
+ end )
115
126
end )
116
127
end )
0 commit comments