Skip to content

Commit

Permalink
Test euneus module (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamthome authored Jul 29, 2024
1 parent 4759d69 commit 622307c
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 6 deletions.
47 changes: 47 additions & 0 deletions test/euneus_SUITE.erl
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
-module(euneus_SUITE).
-behaviour(ct_suite).
-include_lib("stdlib/include/assert.hrl").
-compile([export_all, nowarn_export_all]).

%

-elvis([{elvis_style, dont_repeat_yourself, disable}]).

%% --------------------------------------------------------------------
%% Behaviour (ct_suite) callbacks
%% --------------------------------------------------------------------

all() ->
[
Fun
|| {Fun, 1} <- ?MODULE:module_info(exports),
re:run(atom_to_binary(Fun), <<"^test_">>) =/= nomatch
].

%% --------------------------------------------------------------------
%% Tests
%% --------------------------------------------------------------------

test_encode(Config) when is_list(Config) ->
[
?assertEqual(<<"[\"foo\"]">>, euneus:encode([foo])),
?assertEqual(<<"[\"foo\"]">>, euneus:encode([foo], #{}))
].

test_encode_iodata(Config) when is_list(Config) ->
[
?assertEqual([$[, [$", <<"foo">>, $"], $]], euneus:encode_iodata([foo])),
?assertEqual([$[, [$", <<"foo">>, $"], $]], euneus:encode_iodata([foo], #{}))
].

test_decode(Config) when is_list(Config) ->
[
?assertEqual([<<"foo">>], euneus:decode(<<"[\"foo\"]">>)),
?assertEqual([<<"foo">>], euneus:decode(<<"[\"foo\"]">>, #{}))
].

test_decode_iodata(Config) when is_list(Config) ->
[
?assertEqual([<<"foo">>], euneus:decode_iodata([$[, [$", <<"foo">>, $"], $]])),
?assertEqual([<<"foo">>], euneus:decode_iodata([$[, [$", <<"foo">>, $"], $]], #{}))
].
6 changes: 0 additions & 6 deletions test/euneus_decoder_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ all() ->
re:run(atom_to_binary(Fun), <<"^test_">>) =/= nomatch
].

init_per_suite(Config) ->
Config.

end_per_suite(Config) ->
Config.

%% --------------------------------------------------------------------
%% Tests
%% --------------------------------------------------------------------
Expand Down

0 comments on commit 622307c

Please sign in to comment.