Skip to content

Commit

Permalink
Merge pull request #31 from lordnull/mw-support-erl-21
Browse files Browse the repository at this point in the history
Support erl 21
  • Loading branch information
lordnull authored Jan 15, 2019
2 parents 740d502 + f079a03 commit 3532c37
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: erlang
otp_release:
- 21.0
- 20.0
- 19.0

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PROJECT = rec2json
PROJECT_DESCRIPTION = Compile erlang record definitions into modules to convert them to/from json easily.
PROJECT_VERSION = 4.0.0
PROJECT_VERSION = 4.0.1

TEST_DEPS = proper jsx
dep_proper = git https://github.com/manopapad/proper master
Expand Down
4 changes: 2 additions & 2 deletions ebin/rec2json.app
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{application, rec2json, [
{description, "Compile erlang record definitions into modules to convert them to/from json easily."},
{vsn, "4.0.0"},
{vsn, "4.0.1"},
{modules, ['r2j_compile','r2j_type','rec2json']},
{registered, []},
{applications, [kernel,stdlib]}
]}.
]}.
36 changes: 32 additions & 4 deletions test/default_value_tests.erl
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,39 @@ defaults_test_() ->
],

lists:map(fun({Field, Value}) ->
Name = iolist_to_binary(io_lib:format("ensure ~p is ~p", [Field, Value])),
{Name, fun() ->
?assertEqual(Value, erlang:apply(Rec, Field, []))
end}
create_default_test(Field, Value, Rec)
end, Expectations).

-ifdef(OTP_RELEASE).

-if(?OTP_RELEASE >= 21).

create_default_test(Field, Value, Rec) ->
Name = iolist_to_binary(io_lib:format("ensure ~p is ~p", [Field, Value])),
{Name, fun() ->
?assertEqual(Value, erlang:apply(?MODULE, Field, [Rec]))
end}.

-else.

create_default_test(Field, Value, Rec) ->
Name = iolist_to_binary(io_lib:format("ensure ~p is ~p", [Field, Value])),
{Name, fun() ->
?assertEqual(Value, erlang:apply(?MODULE, Field, [Rec])),
?assertEqual(Value, erlang:apply(Rec, Field, []))
end}.

-endif.

-else.

create_default_test(Field, Value, Rec) ->
Name = iolist_to_binary(io_lib:format("ensure ~p is ~p", [Field, Value])),
{Name, fun() ->
?assertEqual(Value, erlang:apply(?MODULE, Field, [Rec])),
?assertEqual(Value, erlang:apply(Rec, Field, []))
end}.

-endif.

-endif.

0 comments on commit 3532c37

Please # to comment.