Skip to content

Commit 09c1cdd

Browse files
committed
elli_ws_http_tests: init
1 parent 7443c9d commit 09c1cdd

File tree

2 files changed

+14
-19
lines changed

2 files changed

+14
-19
lines changed

src/elli_ws_http.erl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,3 @@ parse(<<C, Rest/bits>>, Acc, Token) when ?IS_TOKEN_SEP(C) ->
2828
parse_before(Rest, [Token|Acc]);
2929
parse(<<C, Rest/bits>>, Acc, Token) ->
3030
parse(Rest, Acc, <<Token/binary, (elli_bstr:lchr(C))>>).
31-
32-
%%
33-
%% Tests
34-
%%
35-
36-
-ifdef(TEST).
37-
38-
-include_lib("eunit/include/eunit.hrl").
39-
40-
tokens_test() ->
41-
?assertEqual([<<"test">>], tokens(<<"test">>)),
42-
?assertEqual([<<"test">>, <<"bla">>, <<"x">>], tokens(<<"test, bla,x">>)),
43-
?assertEqual([<<"test">>, <<"een">>, <<"twee">>], tokens([<<"test">>, <<"een">>, <<"twee">>])),
44-
?assertEqual([<<"test">>, <<"een">>, <<"twee">>], tokens([<<"test,,,">>, <<",,,een,,,">>, <<"twee">>])),
45-
?assertEqual([], tokens(<<",,,">>)),
46-
ok.
47-
48-
-endif.
49-

test/elli_ws_http_tests.erl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-module(elli_ws_http_tests).
2+
3+
-include_lib("eunit/include/eunit.hrl").
4+
5+
6+
tokens_test() ->
7+
?assertMatch([<<"test">>], elli_ws_http:tokens(<<"test">>)),
8+
?assertMatch([<<"test">>, <<"bla">>, <<"x">>],
9+
elli_ws_http:tokens(<<"test, bla,x">>)),
10+
?assertMatch([<<"test">>, <<"een">>, <<"twee">>],
11+
elli_ws_http:tokens([<<"test">>, <<"een">>, <<"twee">>])),
12+
?assertMatch([<<"test">>, <<"een">>, <<"twee">>],
13+
elli_ws_http:tokens([<<"test,,,">>, <<",,,een,,,">>, <<"twee">>])),
14+
?assertMatch([], elli_ws_http:tokens(<<",,,">>)).

0 commit comments

Comments
 (0)