Skip to content

Commit

Permalink
Add missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineGagne committed Nov 28, 2019
1 parent 30c9335 commit 342e402
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/robots_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@
-compile(nowarn_export_all).
-compile(export_all).

-define(UNSUPPORTED_CODE, 109).
-define(CODE_4XX, 418).
-define(CODE_5XX, 514).
-define(EMPTY_CONTENT, <<>>).

all() ->
[
return_error_on_unsupported_status_code,
allow_all_on_4xx_code,
disallow_all_on_5xx
].

init_per_testcase(_Name, Config) ->
Expand All @@ -16,6 +24,20 @@ init_per_testcase(_Name, Config) ->
end_per_testcase(_Name, Config) ->
Config.

return_error_on_unsupported_status_code() ->
[{doc, "Given an unsupported status code, when parsing, then returns an error."}].
return_error_on_unsupported_status_code(_Config) ->
?assertMatch({error, _}, robots:parse(?EMPTY_CONTENT, ?UNSUPPORTED_CODE)).

allow_all_on_4xx_code() ->
[{doc, "Given a 4XX status code, when parsing, then returns all allowed."}].
allow_all_on_4xx_code(_Config) ->
?assertMatch({ok, {allowed, all}}, robots:parse(?EMPTY_CONTENT, ?CODE_4XX)).

disallow_all_on_5xx() ->
[{doc, "Given a 5XX status code, when parsing, then returns all disallowed."}].
disallow_all_on_5xx(_Config) ->
?assertMatch({ok, {disallowed, all}}, robots:parse(?EMPTY_CONTENT, ?CODE_5XX)).

%%%===================================================================
%%% Internal functions
Expand Down

0 comments on commit 342e402

Please sign in to comment.