aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-05-26 15:15:33 +0200
committerBjörn Gustavsson <[email protected]>2014-05-26 15:54:12 +0200
commitd8fa3de932d97db3a93520ac30f60045e8a9cef4 (patch)
treea30a2c3baa40ebaf27ea666df84d679992673f91 /lib/kernel/test
parentce2ea545b8833b8e31322cdcff82f14a9cad8ba8 (diff)
downloadotp-d8fa3de932d97db3a93520ac30f60045e8a9cef4.tar.gz
otp-d8fa3de932d97db3a93520ac30f60045e8a9cef4.tar.bz2
otp-d8fa3de932d97db3a93520ac30f60045e8a9cef4.zip
Teach code:del_path/1 to ignore superfluous slashes
The following sequence will NOT leave the code path unchanged: code:add_path("/some/app/"), . . . code:del_path("/some/app/") The reason is that code:add_path/1 will normalize the path name (removing the trailing slash), while code:del_path/1 does not normalize the path before searching for it in the code path.
Diffstat (limited to 'lib/kernel/test')
-rw-r--r--lib/kernel/test/code_SUITE.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/kernel/test/code_SUITE.erl b/lib/kernel/test/code_SUITE.erl
index 42b81d16b3..f2ddcd57ff 100644
--- a/lib/kernel/test/code_SUITE.erl
+++ b/lib/kernel/test/code_SUITE.erl
@@ -219,6 +219,13 @@ del_path(suite) -> [];
del_path(doc) -> [];
del_path(Config) when is_list(Config) ->
P = code:get_path(),
+ try
+ del_path_1(P)
+ after
+ code:set_path(P)
+ end.
+
+del_path_1(P) ->
test_server:format("Initial code:get_path()=~p~n",[P]),
{'EXIT',_} = (catch code:del_path(3)),
false = code:del_path(my_dummy_name),
@@ -226,19 +233,22 @@ del_path(Config) when is_list(Config) ->
Dir = filename:join([code:lib_dir(kernel),"ebin"]),
test_server:format("kernel dir: ~p~n",[Dir]),
-
true = code:del_path(kernel),
NewP = code:get_path(),
test_server:format("Path after removing 'kernel':~p~n",[NewP]),
ReferenceP = lists:delete(Dir,P),
test_server:format("Reference path:~p~n",[ReferenceP]),
NewP = ReferenceP, % check that dir is deleted
+ code:set_path(P),
+ %% An superfluous "/" should also work.
+ true = code:del_path("kernel/"),
+ NewP = ReferenceP, % check that dir is deleted
code:set_path(P),
+
true = code:del_path(Dir),
NewP1 = code:get_path(),
NewP1 = lists:delete(Dir,P), % check that dir is deleted
- code:set_path(P),
ok.
replace_path(suite) -> [];