aboutsummaryrefslogtreecommitdiffstats
path: root/lib/debugger/test/int_eval_SUITE.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/debugger/test/int_eval_SUITE.erl')
-rw-r--r--lib/debugger/test/int_eval_SUITE.erl200
1 files changed, 100 insertions, 100 deletions
diff --git a/lib/debugger/test/int_eval_SUITE.erl b/lib/debugger/test/int_eval_SUITE.erl
index 393d5d5a5a..27ca4852b5 100644
--- a/lib/debugger/test/int_eval_SUITE.erl
+++ b/lib/debugger/test/int_eval_SUITE.erl
@@ -65,8 +65,8 @@ end_per_group(_GroupName, Config) ->
init_per_testcase(_Case, Config) ->
DataDir = proplists:get_value(data_dir, Config),
- ?line {module,?IM} = int:i(filename:join(DataDir, ?IM)),
- ?line ok = io:format("Interpreted modules: ~p",[int:interpreted()]),
+ {module,?IM} = int:i(filename:join(DataDir, ?IM)),
+ ok = io:format("Interpreted modules: ~p",[int:interpreted()]),
Config.
end_per_testcase(_Case, _Config) ->
@@ -84,80 +84,80 @@ bifs_outside_erlang(Config) when is_list(Config) ->
?IM:ets_delete(Id),
ok
end,
- ?line ok = spawn_eval(Fun),
+ ok = spawn_eval(Fun),
ok.
%% Try evalutate spawn_link/3.
spawning(Config) when is_list(Config) ->
- ?line ok = spawn_eval(fun() -> ?IM:spawn_test() end).
+ ok = spawn_eval(fun() -> ?IM:spawn_test() end).
%% Try various sorts of applies.
applying(Config) when is_list(Config) ->
Fun = fun({number,X}, {number,Y}) -> X+Y end,
- ?line ok = spawn_eval(fun() -> ?IM:apply_test(Fun) end).
+ ok = spawn_eval(fun() -> ?IM:apply_test(Fun) end).
%% Test catch and throw/1.
catch_and_throw(Config) when is_list(Config) ->
- {a,ball} = spawn_eval(fun() -> ok = ?IM:catch_a_ball(),
- catch ?IM:throw_a_ball() end),
-
- %% Throw and catch without any extra outer catch.
-
- ?line process_flag(trap_exit, true),
- ?line Pid1 = spawn_link(fun() -> exit(?IM:catch_a_ball()) end),
- receive
- {'EXIT',Pid1,ok} -> ok;
- {'EXIT',Pid1,Bad1} -> ct:fail({bad_message,Bad1})
- after 5000 ->
- ct:fail(timeout)
- end,
+ {a,ball} = spawn_eval(fun() -> ok = ?IM:catch_a_ball(),
+ catch ?IM:throw_a_ball() end),
+
+ %% Throw and catch without any extra outer catch.
+
+ process_flag(trap_exit, true),
+ Pid1 = spawn_link(fun() -> exit(?IM:catch_a_ball()) end),
+ receive
+ {'EXIT',Pid1,ok} -> ok;
+ {'EXIT',Pid1,Bad1} -> ct:fail({bad_message,Bad1})
+ after 5000 ->
+ ct:fail(timeout)
+ end,
- %% Throw without catch.
+ %% Throw without catch.
- ?line Pid2 = spawn_link(fun() -> ?IM:throw_a_ball() end),
- receive
- {'EXIT',Pid2,{{nocatch,{a,ball}},[_|_]}} -> ok;
- {'EXIT',Pid2,Bad2} -> ct:fail({bad_message,Bad2})
- after 5000 ->
- ct:fail(timeout)
- end,
+ Pid2 = spawn_link(fun() -> ?IM:throw_a_ball() end),
+ receive
+ {'EXIT',Pid2,{{nocatch,{a,ball}},[_|_]}} -> ok;
+ {'EXIT',Pid2,Bad2} -> ct:fail({bad_message,Bad2})
+ after 5000 ->
+ ct:fail(timeout)
+ end,
- ?line ok = ?IM:more_catch(fun(_) -> ?IM:exit_me() end),
- ?line ok = ?IM:more_catch(fun(_) -> exit({unint, exit}) end),
- ?line {a, ball} = ?IM:more_catch(fun(_) -> ?IM:throw_a_ball() end),
- ?line {b, ball} = ?IM:more_catch(fun(_) -> throw({b,ball}) end),
+ ok = ?IM:more_catch(fun(_) -> ?IM:exit_me() end),
+ ok = ?IM:more_catch(fun(_) -> exit({unint, exit}) end),
+ {a, ball} = ?IM:more_catch(fun(_) -> ?IM:throw_a_ball() end),
+ {b, ball} = ?IM:more_catch(fun(_) -> throw({b,ball}) end),
- ExitInt = {'EXIT',{int,exit}},
- ExitU = {'EXIT',{unint,exit}},
+ ExitInt = {'EXIT',{int,exit}},
+ ExitU = {'EXIT',{unint,exit}},
- ?line ExitInt = (catch ?IM:more_nocatch(fun(_) -> ?IM:exit_me() end)),
- ?line ExitU = (catch ?IM:more_nocatch(fun(_) -> exit({unint, exit}) end)),
- ?line {a, ball} = (catch {error, ?IM:more_nocatch(fun(_) -> ?IM:throw_a_ball() end)}),
- ?line {b, ball} = (catch {error, ?IM:more_nocatch(fun(_) -> throw({b,ball}) end)}),
- ok.
+ ExitInt = (catch ?IM:more_nocatch(fun(_) -> ?IM:exit_me() end)),
+ ExitU = (catch ?IM:more_nocatch(fun(_) -> exit({unint, exit}) end)),
+ {a, ball} = (catch {error, ?IM:more_nocatch(fun(_) -> ?IM:throw_a_ball() end)}),
+ {b, ball} = (catch {error, ?IM:more_nocatch(fun(_) -> throw({b,ball}) end)}),
+ ok.
%% Test external calls.
external_call(Config) when is_list(Config) ->
- ?line ok = spawn_eval(fun() -> ?IM:external_call_test({some,stupid,data}) end).
+ ok = spawn_eval(fun() -> ?IM:external_call_test({some,stupid,data}) end).
%% Test the module_info/0,1 functions.
test_module_info(Config) when is_list(Config) ->
- ?line ModInfo = ?IM:module_info(),
- ?line {value,{exports,Exp}} = lists:keysearch(exports, 1, ModInfo),
- ?line {value,{attributes,Attr}} = lists:keysearch(attributes, 1, ModInfo),
- ?line Exp = ?IM:module_info(exports),
- ?line Attr = ?IM:module_info(attributes),
- ?line {value,{stupid_attribute,[{a,b}]}} =
+ ModInfo = ?IM:module_info(),
+ {value,{exports,Exp}} = lists:keysearch(exports, 1, ModInfo),
+ {value,{attributes,Attr}} = lists:keysearch(attributes, 1, ModInfo),
+ Exp = ?IM:module_info(exports),
+ Attr = ?IM:module_info(attributes),
+ {value,{stupid_attribute,[{a,b}]}} =
lists:keysearch(stupid_attribute, 1, Attr),
%% Check exports using a list comprehension in the module itself.
- ?line ok = ?IM:check_exports(Exp),
+ ok = ?IM:check_exports(Exp),
%% Call module_info/0,1 from the module itself.
- ?line ok = ?IM:check_module_info(ModInfo, Exp),
+ ok = ?IM:check_module_info(ModInfo, Exp),
ok.
@@ -165,64 +165,64 @@ test_module_info(Config) when is_list(Config) ->
apply_interpreted_fun(Config) when is_list(Config) ->
%% Called from uninterpreted code
- ?line F1 = spawn_eval(fun() -> ?IM:give_me_a_fun_0() end),
- ?line perfectly_alright = spawn_eval(fun() -> F1() end),
- ?line ATerm = {a,term},
- ?line F2 = spawn_eval(fun() -> ?IM:give_me_a_fun_0(ATerm) end),
- ?line {ok,ATerm} = spawn_eval(fun() -> F2() end),
+ F1 = spawn_eval(fun() -> ?IM:give_me_a_fun_0() end),
+ perfectly_alright = spawn_eval(fun() -> F1() end),
+ ATerm = {a,term},
+ F2 = spawn_eval(fun() -> ?IM:give_me_a_fun_0(ATerm) end),
+ {ok,ATerm} = spawn_eval(fun() -> F2() end),
%% Called from uninterpreted code, badarity
- ?line {'EXIT',{{badarity,{F1,[snape]}},[{?MODULE,_,_,_}|_]}} =
+ {'EXIT',{{badarity,{F1,[snape]}},[{?MODULE,_,_,_}|_]}} =
spawn_eval(fun() -> F1(snape) end),
%% Called from uninterpreted code, error in fun
- ?line F3 = spawn_eval(fun() -> ?IM:give_me_a_bad_fun() end),
- ?line {'EXIT',{snape,[{?IM,_FunName,_,_}|_]}} =
+ F3 = spawn_eval(fun() -> ?IM:give_me_a_bad_fun() end),
+ {'EXIT',{snape,[{?IM,_FunName,_,_}|_]}} =
spawn_eval(fun() -> F3(snape) end),
%% Called from within interpreted code
- ?line perfectly_alright = spawn_eval(fun() -> ?IM:do_apply(F1) end),
+ perfectly_alright = spawn_eval(fun() -> ?IM:do_apply(F1) end),
%% Called from within interpreted code, badarity
- ?line {'EXIT',{{badarity,{F1,[snape]}},[{?IM,do_apply,_,_}|_]}} =
+ {'EXIT',{{badarity,{F1,[snape]}},[{?IM,do_apply,_,_}|_]}} =
spawn_eval(fun() -> ?IM:do_apply(F1, snape) end),
%% Called from within interpreted code, error in fun
- ?line {'EXIT',{snape,[{?IM,_FunName,_,_}|_]}} =
+ {'EXIT',{snape,[{?IM,_FunName,_,_}|_]}} =
spawn_eval(fun() -> ?IM:do_apply(F3, snape) end),
%% Try some more complex funs.
- ?line F4 = ?IM:give_me_a_fun_1(14, 42),
- ?line {false,yes,yeah,false} =
+ F4 = ?IM:give_me_a_fun_1(14, 42),
+ {false,yes,yeah,false} =
F4({{1,nope},{14,yes},{42,yeah},{100,forget_it}}),
- ?line [this_is_ok,me_too] =
+ [this_is_ok,me_too] =
F4([{-24,no_way},{15,this_is_ok},{1333,forget_me},{37,me_too}]),
%% OTP-5837
%% Try fun with guard containing variable bound in environment
- ?line [yes,no,no,no] = ?IM:otp_5837(1),
+ [yes,no,no,no] = ?IM:otp_5837(1),
ok.
%% Apply a fun defined outside interpreted code.
apply_uninterpreted_fun(Config) when is_list(Config) ->
- ?line F1 = fun(snape) ->
- erlang:error(snape);
- (_Arg) ->
- perfectly_alright
- end,
+ F1 = fun(snape) ->
+ erlang:error(snape);
+ (_Arg) ->
+ perfectly_alright
+ end,
%% Ok
- ?line perfectly_alright =
+ perfectly_alright =
spawn_eval(fun() -> ?IM:do_apply(F1, any_arg) end),
%% Badarity (evaluated in dbg_debugged, which calls erlang:apply/2)
- ?line {'EXIT',{{badarity,{F1,[]}},[{erlang,apply,_,_}|_]}} =
+ {'EXIT',{{badarity,{F1,[]}},[{erlang,apply,_,_}|_]}} =
spawn_eval(fun() -> ?IM:do_apply(F1) end),
%% Error in fun
- ?line {'EXIT',{snape,[{?MODULE,_FunName,_,_}|_]}} =
+ {'EXIT',{snape,[{?MODULE,_FunName,_,_}|_]}} =
spawn_eval(fun() -> ?IM:do_apply(F1, snape) end),
ok.
@@ -232,22 +232,22 @@ apply_uninterpreted_fun(Config) when is_list(Config) ->
%%
interpreted_exit(Config) when is_list(Config) ->
- ?line process_flag(trap_exit, true),
- ?line Reason = make_ref(),
- ?line Pid = spawn_link(fun() -> ?IM:please_call_exit(Reason) end),
- ?line receive
- {'EXIT',Pid,Reason} ->
- ok;
- {'EXIT',Pid,BadReason} ->
- ct:fail({bad_message,BadReason})
- after 10000 ->
- ct:fail(timeout)
- end,
+ process_flag(trap_exit, true),
+ Reason = make_ref(),
+ Pid = spawn_link(fun() -> ?IM:please_call_exit(Reason) end),
+ receive
+ {'EXIT',Pid,Reason} ->
+ ok;
+ {'EXIT',Pid,BadReason} ->
+ ct:fail({bad_message,BadReason})
+ after 10000 ->
+ ct:fail(timeout)
+ end,
ok.
%% OTP-8310. Bugfixes lc/bc and andalso/orelse.
otp_8310(Config) when is_list(Config) ->
- ?line ok = ?IM:otp_8310(),
+ ok = ?IM:otp_8310(),
ok.
applier(M, F, A) ->
@@ -256,17 +256,17 @@ applier(M, F, A) ->
Res.
stacktrace(Config) when is_list(Config) ->
- ?line {done,Stk} = do_eval(Config, stacktrace),
- ?line 13 = length(Stk),
- ?line OldStackTraceFlag = int:stack_trace(),
- ?line int:stack_trace(no_tail),
+ {done,Stk} = do_eval(Config, stacktrace),
+ 13 = length(Stk),
+ OldStackTraceFlag = int:stack_trace(),
+ int:stack_trace(no_tail),
try
- ?line Res = spawn_eval(fun() -> stacktrace:stacktrace() end),
- ?line io:format("\nInterpreted (no_tail):\n~p", [Res]),
- ?line {done,Stk} = Res
- after
- ?line int:stack_trace(OldStackTraceFlag)
- end,
+ Res = spawn_eval(fun() -> stacktrace:stacktrace() end),
+ io:format("\nInterpreted (no_tail):\n~p", [Res]),
+ {done,Stk} = Res
+ after
+ int:stack_trace(OldStackTraceFlag)
+ end,
ok.
maps(Config) when is_list(Config) ->
@@ -278,19 +278,19 @@ maps(Config) when is_list(Config) ->
do_eval(Config, Mod) ->
DataDir = proplists:get_value(data_dir, Config),
- ?line ok = file:set_cwd(DataDir),
+ ok = file:set_cwd(DataDir),
- ?line {ok,Mod} = compile:file(Mod, [report,debug_info]),
- ?line {module,Mod} = code:load_file(Mod),
- ?line CompiledRes = Mod:Mod(),
- ?line ok = io:format("Compiled:\n~p", [CompiledRes]),
+ {ok,Mod} = compile:file(Mod, [report,debug_info]),
+ {module,Mod} = code:load_file(Mod),
+ CompiledRes = Mod:Mod(),
+ ok = io:format("Compiled:\n~p", [CompiledRes]),
io:nl(),
- ?line {module,Mod} = int:i(Mod),
- ?line IntRes = Mod:Mod(),
- ?line ok = io:format("Interpreted:\n~p", [IntRes]),
+ {module,Mod} = int:i(Mod),
+ IntRes = Mod:Mod(),
+ ok = io:format("Interpreted:\n~p", [IntRes]),
- ?line CompiledRes = IntRes.
+ CompiledRes = IntRes.
%%
%% Evaluate in another process, to prevent the test_case process to become