Skip to content

Commit

Permalink
Merge branch 'develop' into test-to-require-libs-with-decimal
Browse files Browse the repository at this point in the history
  • Loading branch information
f3c0 authored Aug 10, 2019
2 parents 57b178f + 28e0d74 commit a347f57
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: erlang
otp_release:
- 20.3
- 21.3
- 22.0
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,9 @@ debug:

.PHONY: all examples clean

.PHONY: test
test:
rebar3 do eunit, ct --cover, cover

# this protects the intermediate .erl files from make's auto deletion
#.SECONDARY: $(XRL_INTERM) $(YRL_INTERM)
7 changes: 5 additions & 2 deletions test/luerl_return_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
-include_lib("common_test/include/ct.hrl").

-export([all/0, groups/0, init_per_suite/1, end_per_suite/1]).
-export([simple_return/1, fun_return/1, use_lib/1]).
-export([simple_return/1, fun_return/1, use_lib/1, table_tests/1]).

init_per_suite(Config) ->
DataDir = ?config(data_dir, Config),
Expand All @@ -34,7 +34,7 @@ all() ->

groups() ->
[
{return, [parallel], [simple_return, fun_return, use_lib]}
{return, [parallel], [simple_return, fun_return, use_lib, table_tests]}
].

simple_return(Config) ->
Expand All @@ -52,6 +52,9 @@ use_lib(Config) ->
Expected = [LuaDecimal(B, E) || {B, E} <- [{13, 1}, {7, 1}, {3, 3}]],
run_and_check(Config, "decimal_test.lua", Expected).

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].

Expand Down
9 changes: 9 additions & 0 deletions test/luerl_return_SUITE_data/table_indexed_table.lua
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit a347f57

Please sign in to comment.