Skip to content

Commit

Permalink
Merge branch 'raimo/stdlib/fix-gen_statem-init-actions-check/OTP-1399…
Browse files Browse the repository at this point in the history
…5' into maint-20

* raimo/stdlib/fix-gen_statem-init-actions-check/OTP-13995:
  Test event insert from init
  Fix init to allow all actions
  • Loading branch information
Erlang/OTP committed Mar 21, 2018
2 parents 0f2ead7 + 57b6fd2 commit 8072817
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/stdlib/src/gen_statem.erl
Expand Up @@ -677,9 +677,9 @@ enter(Module, Opts, State, Data, Server, Actions, Parent) ->
NewDebug = ?sys_debug(Debug, {Name,State}, {enter,Event,State}),
case call_callback_mode(S) of
#state{} = NewS ->
loop_event_actions(
loop_event_actions_list(
Parent, NewDebug, NewS,
Events, Event, State, Data, #trans_opts{},
Events, Event, State, Data, false,
NewActions, CallEnter);
[Class,Reason,Stacktrace] ->
terminate(
Expand Down Expand Up @@ -1295,7 +1295,7 @@ parse_actions_next_event(
next_events_r = [{Type,Content}|NextEventsR]});
_ ->
[error,
{bad_action_from_state_function,{next_events,Type,Content}},
{bad_action_from_state_function,{next_event,Type,Content}},
?STACKTRACE(),
?not_sys_debug]
end;
Expand All @@ -1312,7 +1312,7 @@ parse_actions_next_event(
next_events_r = [{Type,Content}|NextEventsR]});
_ ->
[error,
{bad_action_from_state_function,{next_events,Type,Content}},
{bad_action_from_state_function,{next_event,Type,Content}},
?STACKTRACE(),
Debug]
end.
Expand Down
13 changes: 9 additions & 4 deletions lib/stdlib/test/gen_statem_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2016-2017. All Rights Reserved.
%% Copyright Ericsson AB 2016-2018. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,7 @@

-include_lib("common_test/include/ct.hrl").

-compile(export_all).
-compile([export_all, nowarn_export_all]).
-behaviour(gen_statem).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down Expand Up @@ -832,9 +832,14 @@ event_types(_Config) ->
%% Abusing the internal format of From...
#{init =>
fun () ->
{ok, start, undefined}
{ok, start1, undefined,
[{next_event,internal,0}]}
end,
start =>
start1 =>
fun (internal, 0, undefined) ->
{next_state, start2, undefined}
end,
start2 =>
fun ({call,_} = Call, Req, undefined) ->
{next_state, state1, undefined,
[{next_event,internal,1},
Expand Down

0 comments on commit 8072817

Please sign in to comment.