aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/filename_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-03-10 09:57:37 +0100
committerBjörn Gustavsson <[email protected]>2016-03-10 09:57:37 +0100
commite42208ce5d5e76056f9c199d52512275c98b50c1 (patch)
tree016d43ebe0fa7f0fb7dd2bcab9398dc418a4b665 /lib/stdlib/test/filename_SUITE.erl
parent104cca3be8852070cb3c6d5b12ea74fe1591ba9b (diff)
parent25e64aaf1df1ea5c712075a9236367de4cc81359 (diff)
downloadotp-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/filename_SUITE.erl')
-rw-r--r--lib/stdlib/test/filename_SUITE.erl22
1 files changed, 8 insertions, 14 deletions
diff --git a/lib/stdlib/test/filename_SUITE.erl b/lib/stdlib/test/filename_SUITE.erl
index 7f2e4771f3..3d6734b790 100644
--- a/lib/stdlib/test/filename_SUITE.erl
+++ b/lib/stdlib/test/filename_SUITE.erl
@@ -32,7 +32,9 @@
-include_lib("common_test/include/ct.hrl").
-suite() -> [{ct_hooks,[ts_install_cth]}].
+suite() ->
+ [{ct_hooks,[ts_install_cth]},
+ {timetrap,{minutes,1}}].
all() ->
[absname, absname_2,
@@ -70,7 +72,7 @@ end_per_group(_GroupName, Config) ->
absname(Config) when is_list(Config) ->
case os:type() of
{win32, _} ->
- [Drive|_] = ?config(priv_dir, Config),
+ [Drive|_] = proplists:get_value(priv_dir, Config),
Temp = filename:join([Drive|":/"], "temp"),
case file:make_dir(Temp) of
ok -> ok;
@@ -130,7 +132,7 @@ absname(Config) when is_list(Config) ->
absname_2(Config) when is_list(Config) ->
case os:type() of
{win32, _} ->
- [Drive|_] = ?config(priv_dir, Config),
+ [Drive|_] = proplists:get_value(priv_dir, Config),
[Drive|":/temp/foo"] = filename:absname(foo, [Drive|":/temp"]),
[Drive|":/temp/foo"] = filename:absname("foo", [Drive|":/temp"]),
[Drive|":/temp/../ebin"] = filename:absname("../ebin",
@@ -181,7 +183,6 @@ absname_2(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
basename_1(Config) when is_list(Config) ->
- Dog = test_server:timetrap(test_server:seconds(10)),
"." = filename:basename("."),
"foo" = filename:basename("foo"),
"foo" = filename:basename("/usr/foo"),
@@ -202,11 +203,9 @@ basename_1(Config) when is_list(Config) ->
"strange\\but\\true" =
filename:basename("strange\\but\\true")
end,
- test_server:timetrap_cancel(Dog),
ok.
basename_2(Config) when is_list(Config) ->
- Dog = test_server:timetrap(test_server:seconds(10)),
"." = filename:basename(".", ".erl"),
"foo" = filename:basename("foo.erl", ".erl"),
"foo" = filename:basename('foo.erl', ".erl"),
@@ -232,7 +231,6 @@ basename_2(Config) when is_list(Config) ->
"strange\\but\\true" =
filename:basename("strange\\but\\true", ".erl")
end,
- test_server:timetrap_cancel(Dog),
ok.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -431,7 +429,7 @@ find_src(Config) when is_list(Config) ->
%% Make sure that find_src works for a slim BEAM file.
OldPath = code:get_path(),
try
- PrivDir = ?config(priv_dir, Config),
+ PrivDir = proplists:get_value(priv_dir, Config),
code:add_patha(PrivDir),
Src = "simple",
SrcPath = filename:join(PrivDir, Src) ++ ".erl",
@@ -454,7 +452,7 @@ find_src(Config) when is_list(Config) ->
absname_bin(Config) when is_list(Config) ->
case os:type() of
{win32, _} ->
- [Drive|_] = ?config(priv_dir, Config),
+ [Drive|_] = proplists:get_value(priv_dir, Config),
Temp = filename:join([Drive|":/"], "temp"),
case file:make_dir(Temp) of
ok -> ok;
@@ -506,7 +504,7 @@ absname_bin(Config) when is_list(Config) ->
absname_bin_2(Config) when is_list(Config) ->
case os:type() of
{win32, _} ->
- [Drive|_] = ?config(priv_dir, Config),
+ [Drive|_] = proplists:get_value(priv_dir, Config),
<<Drive:8,":/temp/foo">> = filename:absname(<<"foo">>, <<Drive:8,":/temp">>),
<<Drive:8,":/temp/../ebin">> = filename:absname(<<"../ebin">>,
<<Drive:8,":/temp">>),
@@ -553,7 +551,6 @@ absname_bin_2(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
basename_bin_1(Config) when is_list(Config) ->
- Dog = test_server:timetrap(test_server:seconds(10)),
<<".">> = filename:basename(<<".">>),
<<"foo">> = filename:basename(<<"foo">>),
<<"foo">> = filename:basename(<<"/usr/foo">>),
@@ -565,11 +562,9 @@ basename_bin_1(Config) when is_list(Config) ->
_ ->
<<"strange\\but\\true">> = filename:basename(<<"strange\\but\\true">>)
end,
- test_server:timetrap_cancel(Dog),
ok.
basename_bin_2(Config) when is_list(Config) ->
- Dog = test_server:timetrap(test_server:seconds(10)),
<<".">> = filename:basename(<<".">>, <<".erl">>),
<<"foo">> = filename:basename(<<"foo.erl">>, <<".erl">>),
<<"foo.erl">> = filename:basename(<<"/usr/foo.erl">>, <<".hrl">>),
@@ -589,7 +584,6 @@ basename_bin_2(Config) when is_list(Config) ->
<<"strange\\but\\true">> =
filename:basename(<<"strange\\but\\true">>, <<".erl">>)
end,
- test_server:timetrap_cancel(Dog),
ok.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%