diff --git a/test/luerl_return_SUITE.erl b/test/luerl_return_SUITE.erl index b7f78b53..07cb30c6 100644 --- a/test/luerl_return_SUITE.erl +++ b/test/luerl_return_SUITE.erl @@ -17,7 +17,8 @@ -include_lib("common_test/include/ct.hrl"). -export([all/0, groups/0]). --export([simple_return/1, fun_return/1, variable_args/1, check_unicode/1]). + +-export([simple_return/1, fun_return/1, variable_args/1, check_unicode/1, table_tests/1]). all() -> [ @@ -26,7 +27,7 @@ all() -> groups() -> [ - {return, [parallel], [simple_return, fun_return, variable_args, check_unicode]} + {return, [parallel], [simple_return, fun_return, variable_args, check_unicode, table_tests]} ]. simple_return(Config) -> @@ -55,6 +56,10 @@ check_unicode_call_fun(Input, Length, LuaFun, St) -> {[Input, Input, true, Length, Length], _} = luerl:call_function([LuaFun], [Input], St). +table_tests(Config) -> + run_and_check(Config, "table_indexed_table.lua", [111, 222, 333]). + + run_tests(Config, Tests) -> [run_and_check(Config, Script, Expected) || {Script, Expected} <- Tests]. diff --git a/test/luerl_return_SUITE_data/table_indexed_table.lua b/test/luerl_return_SUITE_data/table_indexed_table.lua new file mode 100644 index 00000000..be409f14 --- /dev/null +++ b/test/luerl_return_SUITE_data/table_indexed_table.lua @@ -0,0 +1,9 @@ +tk1 = { a = 1 } +tk2 = { b = 2 } + +t = {} +t[tk1] = 111 +t[tk2] = 222 +t[t] = 333 + +return t[tk1], t[tk2], t[t]