aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stdlib/src')
-rw-r--r--lib/stdlib/src/array.erl16
-rw-r--r--lib/stdlib/src/gen_fsm.erl7
-rw-r--r--lib/stdlib/src/sys.erl11
3 files changed, 27 insertions, 7 deletions
diff --git a/lib/stdlib/src/array.erl b/lib/stdlib/src/array.erl
index 295eeac221..83576c9fd3 100644
--- a/lib/stdlib/src/array.erl
+++ b/lib/stdlib/src/array.erl
@@ -741,11 +741,17 @@ set_get_test_() ->
?_assert(array:get(0, set(0, 42, set(0, 17, new()))) =:= 42),
- ?_assert(array:get(0, reset(0, new())) =:= undefined),
- ?_assert(array:get(0, reset(0, set(0, 17, new()))) =:= undefined),
- ?_assert(array:get(0, reset(0, new({default,42}))) =:= 42),
- ?_assert(array:get(0, reset(0, set(0, 17, new({default,42}))))
- =:= 42)
+ ?_assertError(badarg, array:get(0, reset(11, new([{size,10}])))),
+ ?_assertError(badarg, array:get(0, reset(-1, new([{size,10}])))),
+ ?_assert(array:get(0, reset(0, new())) =:= undefined),
+ ?_assert(array:get(0, reset(0, set(0, 17, new()))) =:= undefined),
+ ?_assert(array:get(0, reset(9, set(9, 17, new()))) =:= undefined),
+ ?_assert(array:get(0, reset(11, set(11, 17, new()))) =:= undefined),
+ ?_assert(array:get(0, reset(11, set(12, 17, new()))) =:= undefined),
+ ?_assert(array:get(0, reset(1, set(12, 17, new()))) =:= undefined),
+ ?_assert(array:get(0, reset(11, new())) =:= undefined),
+ ?_assert(array:get(0, reset(0, set(0, 17, new({default,42})))) =:= 42),
+ ?_assert(array:get(0, reset(0, new({default,42}))) =:= 42)
].
-endif.
diff --git a/lib/stdlib/src/gen_fsm.erl b/lib/stdlib/src/gen_fsm.erl
index f3775f967a..ba0275ae2b 100644
--- a/lib/stdlib/src/gen_fsm.erl
+++ b/lib/stdlib/src/gen_fsm.erl
@@ -603,7 +603,12 @@ get_msg(Msg) -> Msg.
format_status(Opt, StatusData) ->
[PDict, SysState, Parent, Debug, [Name, StateName, StateData, Mod, _Time]] =
StatusData,
- Header = lists:concat(["Status for state machine ", Name]),
+ NameTag = if is_pid(Name) ->
+ pid_to_list(Name);
+ is_atom(Name) ->
+ Name
+ end,
+ Header = lists:concat(["Status for state machine ", NameTag]),
Log = sys:get_debug(log, Debug, []),
Specfic =
case erlang:function_exported(Mod, format_status, 2) of
diff --git a/lib/stdlib/src/sys.erl b/lib/stdlib/src/sys.erl
index e0f2dbcd3c..12209c16d7 100644
--- a/lib/stdlib/src/sys.erl
+++ b/lib/stdlib/src/sys.erl
@@ -245,8 +245,17 @@ do_cmd(SysState, Other, _Parent, _Mod, Debug, Misc) ->
{SysState, {error, {unknown_system_msg, Other}}, Debug, Misc}.
get_status(SysState, Parent, Mod, Debug, Misc) ->
+ PDict = get(),
+ FmtMisc =
+ case erlang:function_exported(Mod, format_status, 2) of
+ true ->
+ FmtArgs = [PDict, SysState, Parent, Debug, Misc],
+ Mod:format_status(normal, FmtArgs);
+ _ ->
+ Misc
+ end,
{status, self(), {module, Mod},
- [get(), SysState, Parent, Debug, Misc]}.
+ [PDict, SysState, Parent, Debug, FmtMisc]}.
%%-----------------------------------------------------------------
%% These are the system debug commands.