diff options
author | Björn Gustavsson <[email protected]> | 2016-03-10 09:57:37 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-03-10 09:57:37 +0100 |
commit | e42208ce5d5e76056f9c199d52512275c98b50c1 (patch) | |
tree | 016d43ebe0fa7f0fb7dd2bcab9398dc418a4b665 /lib/stdlib/test/array_SUITE.erl | |
parent | 104cca3be8852070cb3c6d5b12ea74fe1591ba9b (diff) | |
parent | 25e64aaf1df1ea5c712075a9236367de4cc81359 (diff) | |
download | otp-e42208ce5d5e76056f9c199d52512275c98b50c1.tar.gz otp-e42208ce5d5e76056f9c199d52512275c98b50c1.tar.bz2 otp-e42208ce5d5e76056f9c199d52512275c98b50c1.zip |
Merge branch 'bjorn/stdlib/modernize-tests'
* bjorn/stdlib/modernize-tests:
Eliminate use of ?config() macro
Remove ?line macros
Replace "%" with "%%" at the beginning of a line
Eliminate 'suite' and 'doc' clauses
gen_server_SUITE: Eliminate use of test_server:timecall/3
Use 'test_server' instead of ?t macro
Eliminate use of test_server:messages_get/0
sys_SUITE: Replace test_server:capture*/0 with ct:capture*/0
sys_SUITE: Mend test cases that didn't test what they should
Replace calls to test_server:sleep/1 with ct:sleep/1 or timer:sleep/1
Eliminate use of test_server:do_times()
Replace use of test_server:format/2 with io:format/2
Eliminate use of test_server:fail/0,1
Modernize use of timetraps
Diffstat (limited to 'lib/stdlib/test/array_SUITE.erl')
-rw-r--r-- | lib/stdlib/test/array_SUITE.erl | 77 |
1 files changed, 12 insertions, 65 deletions
diff --git a/lib/stdlib/test/array_SUITE.erl b/lib/stdlib/test/array_SUITE.erl index 6fec03a2f7..8d031ed490 100644 --- a/lib/stdlib/test/array_SUITE.erl +++ b/lib/stdlib/test/array_SUITE.erl @@ -22,11 +22,6 @@ -include_lib("common_test/include/ct.hrl"). -%% Default timetrap timeout (set in init_per_testcase). -%% This should be set relatively high (10-15 times the expected -%% max testcasetime). --define(default_timeout, ?t:seconds(60)). - %% Test server specific exports -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, init_per_group/2,end_per_group/2]). @@ -66,7 +61,9 @@ %% %% all/1 %% -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. all() -> [new_test, fix_test, relax_test, resize_test, @@ -93,12 +90,9 @@ end_per_group(_GroupName, Config) -> init_per_testcase(_Case, Config) -> - ?line Dog=test_server:timetrap(?default_timeout), - [{watchdog, Dog}|Config]. + Config. -end_per_testcase(_Case, Config) -> - Dog=?config(watchdog, Config), - test_server:timetrap_cancel(Dog), +end_per_testcase(_Case, _Config) -> ok. -define(LEAFSIZE,10). @@ -111,19 +105,19 @@ end_per_testcase(_Case, Config) -> }). -define(_assert(What), - begin ?line true = What end + begin true = What end ). -define(_assertNot(What), - begin ?line false = What end + begin false = What end ). -define(_assertMatch(Res,What), begin - ?line case What of Res -> ok end + case What of Res -> ok end end ). -define(_assertError(Reas,What), - begin ?line fun() -> + begin fun() -> try What of A_Success -> exit({test_error, A_Success}) catch error:Reas -> ok end @@ -131,9 +125,9 @@ end_per_testcase(_Case, Config) -> end ). --define(LET(Var,Expr, Test), begin ?line fun() -> Var = Expr, Test end() end). +-define(LET(Var,Expr, Test), begin fun() -> Var = Expr, Test end() end). --define(_test(Expr), begin ?line Expr end). +-define(_test(Expr), begin Expr end). %%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Some helpers to be able to run the tests without testserver @@ -152,18 +146,7 @@ t(What) -> io:format("Failed ~p:~p ~p ~p~n ~p~n", [T,Line,_E,_R, erlang:get_stacktrace()]) end - end, expand(What)). - -expand(All) -> - lists:reverse(expand(All,[])). -expand([H|T], Acc) -> - case ?MODULE:H(suite) of - [] -> expand(T,[H|Acc]); - Cs -> - R = expand(Cs, Acc), - expand(T, R) - end; -expand([], Acc) -> Acc. + end, What). %%%%% extract tests @@ -173,8 +156,6 @@ extract_tests() -> try Tests = extract_tests(In,Out,[]), Call = fun(Test) -> - io:format(Out, "~s(doc) -> [];~n", [Test]), - io:format(Out, "~s(suite) -> [];~n", [Test]), io:format(Out, "~s(Config) when is_list(Config) -> ~s_(), ok.~n", [Test, Test]) end, @@ -775,54 +756,20 @@ sparse_foldr_test_() -> set(0,0,new()))))) ]. -new_test(doc) -> []; -new_test(suite) -> []; new_test(Config) when is_list(Config) -> new_test_(), ok. -fix_test(doc) -> []; -fix_test(suite) -> []; fix_test(Config) when is_list(Config) -> fix_test_(), ok. -relax_test(doc) -> []; -relax_test(suite) -> []; relax_test(Config) when is_list(Config) -> relax_test_(), ok. -resize_test(doc) -> []; -resize_test(suite) -> []; resize_test(Config) when is_list(Config) -> resize_test_(), ok. -set_get_test(doc) -> []; -set_get_test(suite) -> []; set_get_test(Config) when is_list(Config) -> set_get_test_(), ok. -to_list_test(doc) -> []; -to_list_test(suite) -> []; to_list_test(Config) when is_list(Config) -> to_list_test_(), ok. -sparse_to_list_test(doc) -> []; -sparse_to_list_test(suite) -> []; sparse_to_list_test(Config) when is_list(Config) -> sparse_to_list_test_(), ok. -from_list_test(doc) -> []; -from_list_test(suite) -> []; from_list_test(Config) when is_list(Config) -> from_list_test_(), ok. -to_orddict_test(doc) -> []; -to_orddict_test(suite) -> []; to_orddict_test(Config) when is_list(Config) -> to_orddict_test_(), ok. -sparse_to_orddict_test(doc) -> []; -sparse_to_orddict_test(suite) -> []; sparse_to_orddict_test(Config) when is_list(Config) -> sparse_to_orddict_test_(), ok. -from_orddict_test(doc) -> []; -from_orddict_test(suite) -> []; from_orddict_test(Config) when is_list(Config) -> from_orddict_test_(), ok. -map_test(doc) -> []; -map_test(suite) -> []; map_test(Config) when is_list(Config) -> map_test_(), ok. -sparse_map_test(doc) -> []; -sparse_map_test(suite) -> []; sparse_map_test(Config) when is_list(Config) -> sparse_map_test_(), ok. -foldl_test(doc) -> []; -foldl_test(suite) -> []; foldl_test(Config) when is_list(Config) -> foldl_test_(), ok. -sparse_foldl_test(doc) -> []; -sparse_foldl_test(suite) -> []; sparse_foldl_test(Config) when is_list(Config) -> sparse_foldl_test_(), ok. -foldr_test(doc) -> []; -foldr_test(suite) -> []; foldr_test(Config) when is_list(Config) -> foldr_test_(), ok. -sparse_foldr_test(doc) -> []; -sparse_foldr_test(suite) -> []; sparse_foldr_test(Config) when is_list(Config) -> sparse_foldr_test_(), ok. |