Skip to content

Commit

Permalink
remove "step" as a valid callable function
Browse files Browse the repository at this point in the history
  • Loading branch information
ericbmerritt committed Sep 8, 2011
1 parent 679117a commit 3dc7600
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/cucumberl.erl
Expand Up @@ -184,7 +184,7 @@ process_line({LineNum, Line},
missing -> missing ->
io:format("NO-STEP~n~n"), io:format("NO-STEP~n~n"),
io:format("a step definition snippet...~n"), io:format("a step definition snippet...~n"),
io:format("step(~p, _) ->~n undefined.~n~n", [Tokens]), format_missing_step(GWT2, Tokens),
{undefined, undefined, undefined, Stats2}; {undefined, undefined, undefined, Stats2};
failed -> failed ->
io:format("FAIL ~n"), io:format("FAIL ~n"),
Expand All @@ -206,8 +206,7 @@ apply_step(FeatureModule, G, undefined, Tokens, Line, LineNum) ->
apply(FeatureModule, G, [Tokens, apply(FeatureModule, G, [Tokens,
{Line, LineNum}]); {Line, LineNum}]);
false -> false ->
FeatureModule:step([G | Tokens], step_undefined
{Line, LineNum})
end; end;
apply_step(FeatureModule, G, State, Tokens, Line, LineNum) -> apply_step(FeatureModule, G, State, Tokens, Line, LineNum) ->
case erlang:function_exported(FeatureModule, G, 3) of case erlang:function_exported(FeatureModule, G, 3) of
Expand All @@ -216,19 +215,18 @@ apply_step(FeatureModule, G, State, Tokens, Line, LineNum) ->
State, State,
{Line, LineNum}]); {Line, LineNum}]);
false -> false ->
FeatureModule:step([G | Tokens], step_undefined
State,
{Line, LineNum})
end. end.


check_step(true) -> {passed, undefined}; check_step(true) -> {passed, undefined};
check_step(ok) -> {passed, undefined}; check_step(ok) -> {passed, undefined};
check_step({ok, State}) -> {passed, State}; check_step({ok, State}) -> {passed, State};
check_step({true, State}) -> {passed, State}; check_step({true, State}) -> {passed, State};
check_step(undefined) -> missing; check_step(undefined) -> missing;
check_step(false) -> failed; check_step(step_undefined) -> missing;
check_step({failed, _}) -> failed; check_step(false) -> failed;
check_step(_) -> ignored. check_step({failed, _}) -> failed;
check_step(_) -> ignored.


step(['feature:' | _], _Line) -> true; step(['feature:' | _], _Line) -> true;
step(['scenario:' | _], _Line) -> true; step(['scenario:' | _], _Line) -> true;
Expand Down Expand Up @@ -299,6 +297,11 @@ string_to_atoms(StrWords) ->
lists:map(fun (Y) -> list_to_atom(string:to_lower(Y)) end, lists:map(fun (Y) -> list_to_atom(string:to_lower(Y)) end,
string:tokens(StrWords, " ")). string:tokens(StrWords, " ")).


format_missing_step('when', [_ | Tokens]) ->
io:format("'when'(~p, State, _) ->~n undefined.~n~n", [Tokens]);
format_missing_step(GWT, [_ | Tokens]) ->
io:format("~p(~p, State, _) ->~n undefined.~n~n", [GWT, Tokens]).

% ------------------------------------ % ------------------------------------


unzip_test() -> unzip_test() ->
Expand Down

0 comments on commit 3dc7600

Please sign in to comment.