aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/test')
-rw-r--r--erts/emulator/test/module_info_SUITE.erl21
-rw-r--r--erts/emulator/test/module_info_SUITE_data/module_info_test.erl24
2 files changed, 43 insertions, 2 deletions
diff --git a/erts/emulator/test/module_info_SUITE.erl b/erts/emulator/test/module_info_SUITE.erl
index 1125cf3072..362e210d20 100644
--- a/erts/emulator/test/module_info_SUITE.erl
+++ b/erts/emulator/test/module_info_SUITE.erl
@@ -24,7 +24,7 @@
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
init_per_group/2,end_per_group/2,
init_per_testcase/2,end_per_testcase/2,
- exports/1,functions/1,native/1,info/1]).
+ exports/1,functions/1,deleted/1,native/1,info/1]).
%%-compile(native).
@@ -53,7 +53,7 @@ end_per_group(_GroupName, Config) ->
modules() ->
- [exports, functions, native, info].
+ [exports, functions, deleted, native, info].
init_per_testcase(Func, Config) when is_atom(Func), is_list(Config) ->
Dog = ?t:timetrap(?t:minutes(3)),
@@ -93,6 +93,23 @@ functions(Config) when is_list(Config) ->
?line All = lists:sort(?MODULE:module_info(functions)),
ok.
+%% Test that deleted modules cause badarg
+deleted(Config) when is_list(Config) ->
+ ?line Data = ?config(data_dir, Config),
+ ?line File = filename:join(Data, "module_info_test"),
+ ?line {ok,module_info_test,Code} = compile:file(File, [binary]),
+ ?line {module,module_info_test} = erlang:load_module(module_info_test, Code),
+ ?line 17 = module_info_test:f(),
+ ?line [_|_] = erlang:get_module_info(module_info_test, attributes),
+ ?line [_|_] = erlang:get_module_info(module_info_test),
+ ?line erlang:delete_module(module_info_test),
+ ?line {'EXIT',{undef, _}} = (catch module_info_test:f()),
+ ?line {'EXIT',{badarg, _}} =
+ (catch erlang:get_module_info(module_info_test, attributes)),
+ ?line {'EXIT',{badarg, _}} =
+ (catch erlang:get_module_info(module_info_test)),
+ ok.
+
%% Test that the list of exported functions from this module is correct.
%% Verify that module_info(native) works.
native(Config) when is_list(Config) ->
diff --git a/erts/emulator/test/module_info_SUITE_data/module_info_test.erl b/erts/emulator/test/module_info_SUITE_data/module_info_test.erl
new file mode 100644
index 0000000000..f045f38464
--- /dev/null
+++ b/erts/emulator/test/module_info_SUITE_data/module_info_test.erl
@@ -0,0 +1,24 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2015. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+
+-module(module_info_test).
+-export([f/0]).
+
+f() ->
+ 17.