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/erl_anno_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/erl_anno_SUITE.erl')
-rw-r--r-- | lib/stdlib/test/erl_anno_SUITE.erl | 49 |
1 files changed, 18 insertions, 31 deletions
diff --git a/lib/stdlib/test/erl_anno_SUITE.erl b/lib/stdlib/test/erl_anno_SUITE.erl index 79b27c6217..637a390c70 100644 --- a/lib/stdlib/test/erl_anno_SUITE.erl +++ b/lib/stdlib/test/erl_anno_SUITE.erl @@ -19,7 +19,7 @@ %% -module(erl_anno_SUITE). -%-define(debug, true). +%%-define(debug, true). -ifdef(debug). -include_lib("common_test/include/ct.hrl"). @@ -46,7 +46,9 @@ groups() -> line, location, record, text, bad]}, {parse, [], [parse_abstract, mapfold_anno]}]. -suite() -> [{ct_hooks,[ts_install_cth]}]. +suite() -> + [{ct_hooks,[ts_install_cth]}, + {timetrap,{minutes,1}}]. init_per_suite(Config) -> Config. @@ -61,26 +63,21 @@ end_per_group(_GroupName, Config) -> Config. init_per_testcase(_Case, Config) -> - Dog=?t:timetrap(?t:minutes(1)), - [{watchdog, Dog}|Config]. + Config. end_per_testcase(_Case, _Config) -> - Dog=?config(watchdog, _Config), - test_server:timetrap_cancel(Dog), ok. -define(INFO(T, V), {T, V}). -dialyzer({no_fail_call, new/1}). -new(doc) -> - ["Test erl_anno:new/1"]; +%% Test erl_anno:new/1. new(_Config) -> {'EXIT', {badarg, _}} = (catch erl_anno:new([{location,1},{text, "text"}])), % badarg ok. -is_anno(doc) -> - ["Test erl_anno:is_anno/1"]; +%% Test erl_anno:is_anno/1. is_anno(_Config) -> false = erl_anno:is_anno(a), false = erl_anno:is_anno({a}), @@ -106,8 +103,7 @@ is_anno(_Config) -> true = erl_anno:is_anno(A5), ok. -generated(doc) -> - ["Test 'generated'"]; +%% Test 'generated'. generated(_Config) -> test(1, [{generated, true}, {generated, false}]), test(1, [{generated, false}, {generated, true}, {generated, false}]), @@ -127,8 +123,7 @@ generated(_Config) -> {generated, false}]), ok. -end_location(doc) -> - ["Test 'end_location'"]; +%% Test 'end_location'. end_location(_Config) -> test({1, 17}, [{text, "TEXT", [{end_location, {1, 21}}, {length, 4}]}, {text, "TEXT\n", [{end_location, {2, 1}}, {length, 5}]}, @@ -138,23 +133,20 @@ end_location(_Config) -> {text, "TEXT\ntxt", [{end_location, 2}, {length, 8}]}]), ok. -file(doc) -> - ["Test 'file'"]; +%% Test 'file'. file(_Config) -> test(1, [{file, "name"}, {file, ""}]), test({1, 17}, [{file, "name"}, {file, ""}]), ok. -line(doc) -> - ["Test 'line'"]; +%% Test 'line'. line(_Config) -> test(1, [{line, 17, [{location, 17}]}, {location, {9, 8}, [{line, 9}, {column, 8}]}, {line, 14, [{location, {14, 8}}]}]), ok. -location(doc) -> - ["Test 'location'"]; +%% Test 'location'. location(_Config) -> test(1, [{location, 2, [{line,2}]}, {location, {1, 17}, [{line, 1}, {column, 17}]}, @@ -172,8 +164,7 @@ location(_Config) -> {location, 9, [{column, undefined}]}]), ok. -record(doc) -> - ["Test 'record'"]; +%% Test 'record'. record(_Config) -> test({1, 17}, [{record, true}, {record, false}]), test(1, [{record, true}, {record, false}]), @@ -193,8 +184,7 @@ record(_Config) -> {generated, false}]), ok. -text(doc) -> - ["Test 'text'"]; +%% Test 'text'. text(_Config) -> test(1, [{text, "text", [{end_location, 1}, {length, 4}]}, {text, "", [{end_location, 1}, {length, 0}]}]), @@ -203,8 +193,7 @@ text(_Config) -> ok. -dialyzer({[no_opaque, no_fail_call], bad/1}). -bad(doc) -> - ["Test bad annotations"]; +%% Test bad annotations. bad(_Config) -> Line = erl_anno:new(1), LineColumn = erl_anno:new({1, 17}), @@ -229,9 +218,8 @@ bad(_Config) -> (catch erl_anno:record(bad)), % 1st arg not opaque ok. -parse_abstract(doc) -> - ["Test erl_parse:new_anno/1, erl_parse:anno_to_term/1" - ", and erl_parse:anno_from_term/1"]; +%% Test erl_parse:new_anno/1, erl_parse:anno_to_term/1, +%% and erl_parse:anno_from_term/1. parse_abstract(_Config) -> T = sample_term(), A = erl_parse:abstract(T, [{line,17}]), @@ -242,8 +230,7 @@ parse_abstract(_Config) -> T = erl_parse:normalise(Abstr2), ok. -mapfold_anno(doc) -> - ["Test erl_parse:{map_anno/2,fold_anno/3, and mapfold_anno/3}"]; +%% Test erl_parse:{map_anno/2,fold_anno/3, and mapfold_anno/3}. mapfold_anno(_Config) -> T = sample_term(), Abstr = erl_parse:abstract(T), |