diff options
author | Björn Gustavsson <[email protected]> | 2016-03-02 06:50:54 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-03-10 15:11:00 +0100 |
commit | 0ba20cd6d43e277593b59463d2c2959bb6db0957 (patch) | |
tree | 5c9fac877f54fe9b26622125707f030361af86c1 /lib/kernel/test/file_name_SUITE.erl | |
parent | 3dfdf35c65b8985a3abe21ef83f27cc8e82ba11c (diff) | |
download | otp-0ba20cd6d43e277593b59463d2c2959bb6db0957.tar.gz otp-0ba20cd6d43e277593b59463d2c2959bb6db0957.tar.bz2 otp-0ba20cd6d43e277593b59463d2c2959bb6db0957.zip |
Remove ?line macros
While we are it, also re-ident the files.
Diffstat (limited to 'lib/kernel/test/file_name_SUITE.erl')
-rw-r--r-- | lib/kernel/test/file_name_SUITE.erl | 464 |
1 files changed, 232 insertions, 232 deletions
diff --git a/lib/kernel/test/file_name_SUITE.erl b/lib/kernel/test/file_name_SUITE.erl index bedcac7923..be4ef9c394 100644 --- a/lib/kernel/test/file_name_SUITE.erl +++ b/lib/kernel/test/file_name_SUITE.erl @@ -101,10 +101,10 @@ end_per_suite(_Config) -> ok. init_per_group(_GroupName, Config) -> - Config. + Config. end_per_group(_GroupName, Config) -> - Config. + Config. %% Check that Erlang can be started with unicode named home directory. home_dir(Config) when is_list(Config) -> @@ -155,30 +155,30 @@ home_dir(Config) when is_list(Config) -> normalize(Config) when is_list(Config) -> rand:seed(exsplus, {1290,431421,830412}), try - ?line UniMode = file:native_name_encoding() =/= latin1, + UniMode = file:native_name_encoding() =/= latin1, if not UniMode -> throw(need_unicode_mode); true -> ok end, - ?line Pairs = [rand_comp_decomp(200) || _ <- lists:seq(1,1000)], + Pairs = [rand_comp_decomp(200) || _ <- lists:seq(1,1000)], case os:type() of {unix,darwin} -> - ?line [ true = (A =:= prim_file:internal_native2name(B)) || + [ true = (A =:= prim_file:internal_native2name(B)) || {A,B} <- Pairs ]; _ -> ok end, - ?line [ true = (A =:= prim_file:internal_normalize_utf8(B)) || - {A,B} <- Pairs ] - + [ true = (A =:= prim_file:internal_normalize_utf8(B)) || + {A,B} <- Pairs ] + catch throw:need_unicode_mode -> io:format("Sorry, can only run in unicode mode.~n"), {skipped,"VM needs to be started in Unicode filename mode"} end. - + %% Check file operations on normal file names regardless of unicode mode. normal(Config) when is_list(Config) -> {ok,Dir} = file:get_cwd(), @@ -195,7 +195,7 @@ normal(Config) when is_list(Config) -> after file:set_cwd(Dir) end. - + %% Check file operations on normal file names regardless of unicode mode. icky(Config) when is_list(Config) -> @@ -244,77 +244,77 @@ very_icky(Config) when is_list(Config) -> file:set_cwd(Dir) end end. - + check_normal(Mod) -> {ok,Dir} = Mod:get_cwd(), try - ?line make_normal_dir(Mod), - ?line {ok, L0} = Mod:list_dir("."), - ?line L1 = lists:sort(L0), - ?line L1 = lists:sort(list(normal_dir())), - ?line {ok,D2} = Mod:get_cwd(), - ?line true = is_list(D2), - ?line case Mod:altname("fil1") of + make_normal_dir(Mod), + {ok, L0} = Mod:list_dir("."), + L1 = lists:sort(L0), + L1 = lists:sort(list(normal_dir())), + {ok,D2} = Mod:get_cwd(), + true = is_list(D2), + case Mod:altname("fil1") of {error,enotsup} -> ok; {ok,LLL} when is_list(LLL) -> ok end, - ?line [ true = is_list(El) || El <- L1], - ?line Syms = [ {S,Targ,list_to_binary(get_data(Targ,normal_dir()))} + [ true = is_list(El) || El <- L1], + Syms = [ {S,Targ,list_to_binary(get_data(Targ,normal_dir()))} || {T,S,Targ} <- normal_dir(), T =:= symlink ], - ?line [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ], - ?line [ {ok, Targ} = fixlink(Mod:read_link(SymL)) || {SymL,Targ,_} <- Syms ], - ?line chk_cre_dir(Mod,[{directory,"temp_dir",normal_dir()}]), - ?line {ok,BeginAt} = Mod:get_cwd(), - ?line true = is_list(BeginAt), - ?line {error,enoent} = Mod:set_cwd("tmp_dir"), - ?line ok = Mod:set_cwd("temp_dir"), - ?line {ok, NowAt} = Mod:get_cwd(), - ?line true = BeginAt =/= NowAt, - ?line ok = Mod:set_cwd(".."), - ?line {ok,BeginAt} = Mod:get_cwd(), - ?line rm_r(Mod,"temp_dir"), - ?line true = is_list(Dir), - ?line [ true = is_list(FN) || FN <- L0 ], + [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ], + [ {ok, Targ} = fixlink(Mod:read_link(SymL)) || {SymL,Targ,_} <- Syms ], + chk_cre_dir(Mod,[{directory,"temp_dir",normal_dir()}]), + {ok,BeginAt} = Mod:get_cwd(), + true = is_list(BeginAt), + {error,enoent} = Mod:set_cwd("tmp_dir"), + ok = Mod:set_cwd("temp_dir"), + {ok, NowAt} = Mod:get_cwd(), + true = BeginAt =/= NowAt, + ok = Mod:set_cwd(".."), + {ok,BeginAt} = Mod:get_cwd(), + rm_r(Mod,"temp_dir"), + true = is_list(Dir), + [ true = is_list(FN) || FN <- L0 ], case has_links() of true -> - ?line ok = Mod:make_link("fil1","nisse"), - ?line {ok, <<"fil1">>} = Mod:read_file("nisse"), - ?line {ok, #file_info{type = regular}} = Mod:read_link_info("nisse"), - ?line ok = Mod:delete("nisse"), - ?line {ok, <<"fil1">>} = Mod:read_file("fil1"), - ?line {error,enoent} = Mod:read_file("nisse"), - ?line {error,enoent} = Mod:read_link_info("nisse"); + ok = Mod:make_link("fil1","nisse"), + {ok, <<"fil1">>} = Mod:read_file("nisse"), + {ok, #file_info{type = regular}} = Mod:read_link_info("nisse"), + ok = Mod:delete("nisse"), + {ok, <<"fil1">>} = Mod:read_file("fil1"), + {error,enoent} = Mod:read_file("nisse"), + {error,enoent} = Mod:read_link_info("nisse"); false -> ok end, - ?line [ begin - ?line {ok, FD} = Mod:open(Name,[read]), - ?line {ok, Content} = Mod:read(FD,1024), - ?line ok = file:close(FD) + [ begin + {ok, FD} = Mod:open(Name,[read]), + {ok, Content} = Mod:read(FD,1024), + ok = file:close(FD) end || {regular,Name,Content} <- normal_dir() ], - ?line [ begin - ?line {ok, FD} = Mod:open(Name,[read,binary]), - ?line BC = list_to_binary(Content), - ?line {ok, BC} = Mod:read(FD,1024), - ?line ok = file:close(FD) + [ begin + {ok, FD} = Mod:open(Name,[read,binary]), + BC = list_to_binary(Content), + {ok, BC} = Mod:read(FD,1024), + ok = file:close(FD) end || {regular,Name,Content} <- normal_dir() ], - ?line Mod:rename("fil1","tmp_fil1"), - ?line {ok, <<"fil1">>} = Mod:read_file("tmp_fil1"), - ?line {error,enoent} = Mod:read_file("fil1"), - ?line Mod:rename("tmp_fil1","fil1"), - ?line {ok, <<"fil1">>} = Mod:read_file("fil1"), - ?line {error,enoent} = Mod:read_file("tmp_fil1"), - ?line {ok,FI} = Mod:read_file_info("fil1"), - ?line NewMode = FI#file_info.mode band (bnot 8#333), - ?line NewMode2 = NewMode bor 8#222, - ?line true = NewMode2 =/= NewMode, - ?line ok = Mod:write_file_info("fil1",FI#file_info{mode = NewMode}), - ?line {ok,#file_info{mode = NewMode}} = Mod:read_file_info("fil1"), - ?line ok = Mod:write_file_info("fil1",FI#file_info{mode = NewMode2}), - ?line {ok,#file_info{mode = NewMode2}} = Mod:read_file_info("fil1"), + Mod:rename("fil1","tmp_fil1"), + {ok, <<"fil1">>} = Mod:read_file("tmp_fil1"), + {error,enoent} = Mod:read_file("fil1"), + Mod:rename("tmp_fil1","fil1"), + {ok, <<"fil1">>} = Mod:read_file("fil1"), + {error,enoent} = Mod:read_file("tmp_fil1"), + {ok,FI} = Mod:read_file_info("fil1"), + NewMode = FI#file_info.mode band (bnot 8#333), + NewMode2 = NewMode bor 8#222, + true = NewMode2 =/= NewMode, + ok = Mod:write_file_info("fil1",FI#file_info{mode = NewMode}), + {ok,#file_info{mode = NewMode}} = Mod:read_file_info("fil1"), + ok = Mod:write_file_info("fil1",FI#file_info{mode = NewMode2}), + {ok,#file_info{mode = NewMode2}} = Mod:read_file_info("fil1"), ok after case Mod:read_file_info("fil1") of @@ -331,129 +331,129 @@ check_normal(Mod) -> check_icky(Mod) -> {ok,Dir} = Mod:get_cwd(), try - ?line true=(length("åäö") =:= 3), - ?line UniMode = file:native_name_encoding() =/= latin1, - ?line make_icky_dir(Mod), + true=(length("åäö") =:= 3), + UniMode = file:native_name_encoding() =/= latin1, + make_icky_dir(Mod), {ok, L0} = Mod:list_dir_all("."), - ?line L1 = lists:sort(L0), + L1 = lists:sort(L0), io:format("~p~n~p~n~n",[L1,lists:sort(list(icky_dir()))]), - ?line L1 = lists:sort(convlist(list(icky_dir()))), - ?line {ok,D2} = Mod:get_cwd(), - ?line true = is_list(D2), -%% Altname only on windows, and there are no non native filenames there -%% ?line case Mod:altname("fil1") of -%% {error,enotsup} -> -%% ok; -%% {ok,LLL} when is_list(LLL) -> -%% ok -%% end, - ?line [ true = ((is_list(El) or (UniMode and is_binary(El)))) || El <- L1], - ?line Syms = [ {S,conv(Targ),list_to_binary(get_data(Targ,icky_dir()))} + L1 = lists:sort(convlist(list(icky_dir()))), + {ok,D2} = Mod:get_cwd(), + true = is_list(D2), + %% Altname only on windows, and there are no non native filenames there + %% case Mod:altname("fil1") of + %% {error,enotsup} -> + %% ok; + %% {ok,LLL} when is_list(LLL) -> + %% ok + %% end, + [ true = ((is_list(El) or (UniMode and is_binary(El)))) || El <- L1], + Syms = [ {S,conv(Targ),list_to_binary(get_data(Targ,icky_dir()))} || {T,S,Targ} <- icky_dir(), T =:= symlink ], - ?line [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ], + [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ], [ {ok, Targ} = fixlink(Mod:read_link_all(SymL)) || {SymL,Targ,_} <- Syms ], - ?line chk_cre_dir(Mod,[{directory,"åäö_dir",icky_dir()}]), - ?line {ok,BeginAt} = Mod:get_cwd(), - ?line true = is_list(BeginAt), - ?line {error,enoent} = Mod:set_cwd("åä_dir"), - ?line ok = Mod:set_cwd("åäö_dir"), - ?line {ok, NowAt} = Mod:get_cwd(), - ?line true = is_list(NowAt), - ?line true = BeginAt =/= NowAt, - ?line ok = Mod:set_cwd(".."), - ?line {ok,BeginAt} = Mod:get_cwd(), - ?line rm_r2(Mod,"åäö_dir"), + chk_cre_dir(Mod,[{directory,"åäö_dir",icky_dir()}]), + {ok,BeginAt} = Mod:get_cwd(), + true = is_list(BeginAt), + {error,enoent} = Mod:set_cwd("åä_dir"), + ok = Mod:set_cwd("åäö_dir"), + {ok, NowAt} = Mod:get_cwd(), + true = is_list(NowAt), + true = BeginAt =/= NowAt, + ok = Mod:set_cwd(".."), + {ok,BeginAt} = Mod:get_cwd(), + rm_r2(Mod,"åäö_dir"), {OS,_} = os:type(), %% Check that treat_icky really converts to the same as the OS case UniMode of true -> - ?line chk_cre_dir(Mod,[{directory,"åäö_dir",[]}]), - ?line ok = Mod:set_cwd("åäö_dir"), - ?line ok = Mod:write_file(<<"ååå">>,<<"hello">>), - ?line Treated = treat_icky(<<"ååå">>), + chk_cre_dir(Mod,[{directory,"åäö_dir",[]}]), + ok = Mod:set_cwd("åäö_dir"), + ok = Mod:write_file(<<"ååå">>,<<"hello">>), + Treated = treat_icky(<<"ååå">>), {ok,[Treated]} = Mod:list_dir_all("."), - ?line ok = Mod:delete(<<"ååå">>), - ?line {ok,[]} = Mod:list_dir("."), - ?line ok = Mod:set_cwd(".."), - ?line rm_r2(Mod,"åäö_dir"); + ok = Mod:delete(<<"ååå">>), + {ok,[]} = Mod:list_dir("."), + ok = Mod:set_cwd(".."), + rm_r2(Mod,"åäö_dir"); false -> ok end, - ?line chk_cre_dir(Mod,[{directory,treat_icky(<<"åäö_dir">>),icky_dir()}]), + chk_cre_dir(Mod,[{directory,treat_icky(<<"åäö_dir">>),icky_dir()}]), if UniMode and (OS =/= win32) -> - ?line {error,enoent} = Mod:set_cwd("åäö_dir"); + {error,enoent} = Mod:set_cwd("åäö_dir"); true -> ok end, - ?line {ok,BeginAt} = Mod:get_cwd(), + {ok,BeginAt} = Mod:get_cwd(), case has_links() of true -> - ?line ok = Mod:make_link("fil1","nisseö"), - ?line {ok, <<"fil1">>} = Mod:read_file("nisseö"), - ?line {ok, #file_info{type = regular}} = Mod:read_link_info("nisseö"), - ?line ok = Mod:delete("nisseö"), - ?line ok = Mod:make_link("fil1",treat_icky(<<"nisseö">>)), - ?line {ok, <<"fil1">>} = Mod:read_file(treat_icky(<<"nisseö">>)), - ?line {ok, #file_info{type = regular}} = Mod:read_link_info(treat_icky(<<"nisseö">>)), - ?line ok = Mod:delete(treat_icky(<<"nisseö">>)), - ?line {ok, <<"fil1">>} = Mod:read_file("fil1"), - ?line {error,enoent} = Mod:read_file("nisseö"), - ?line {error,enoent} = Mod:read_link_info("nisseö"), - ?line {error,enoent} = Mod:read_file(treat_icky(<<"nisseö">>)), - ?line {error,enoent} = Mod:read_link_info(treat_icky(<<"nisseö">>)); + ok = Mod:make_link("fil1","nisseö"), + {ok, <<"fil1">>} = Mod:read_file("nisseö"), + {ok, #file_info{type = regular}} = Mod:read_link_info("nisseö"), + ok = Mod:delete("nisseö"), + ok = Mod:make_link("fil1",treat_icky(<<"nisseö">>)), + {ok, <<"fil1">>} = Mod:read_file(treat_icky(<<"nisseö">>)), + {ok, #file_info{type = regular}} = Mod:read_link_info(treat_icky(<<"nisseö">>)), + ok = Mod:delete(treat_icky(<<"nisseö">>)), + {ok, <<"fil1">>} = Mod:read_file("fil1"), + {error,enoent} = Mod:read_file("nisseö"), + {error,enoent} = Mod:read_link_info("nisseö"), + {error,enoent} = Mod:read_file(treat_icky(<<"nisseö">>)), + {error,enoent} = Mod:read_link_info(treat_icky(<<"nisseö">>)); false -> ok end, - ?line [ begin - ?line {ok, FD} = Mod:open(Name,[read]), - ?line {ok, Content} = Mod:read(FD,1024), - ?line ok = file:close(FD) + [ begin + {ok, FD} = Mod:open(Name,[read]), + {ok, Content} = Mod:read(FD,1024), + ok = file:close(FD) end || {regular,Name,Content} <- icky_dir() ], - ?line [ begin - ?line {ok, FD} = Mod:open(Name,[read,binary]), - ?line BC = list_to_binary([Content]), - ?line {ok, BC} = Mod:read(FD,1024), - ?line ok = file:close(FD) + [ begin + {ok, FD} = Mod:open(Name,[read,binary]), + BC = list_to_binary([Content]), + {ok, BC} = Mod:read(FD,1024), + ok = file:close(FD) end || {regular,Name,Content} <- icky_dir() ], - ?line Mod:rename("åäö2","åäö_fil1"), - ?line {ok, <<"åäö2">>} = Mod:read_file("åäö_fil1"), - ?line {error,enoent} = Mod:read_file("åäö2"), - ?line Mod:rename("åäö_fil1","åäö2"), - ?line {ok, <<"åäö2">>} = Mod:read_file("åäö2"), - ?line {error,enoent} = Mod:read_file("åäö_fil1"), + Mod:rename("åäö2","åäö_fil1"), + {ok, <<"åäö2">>} = Mod:read_file("åäö_fil1"), + {error,enoent} = Mod:read_file("åäö2"), + Mod:rename("åäö_fil1","åäö2"), + {ok, <<"åäö2">>} = Mod:read_file("åäö2"), + {error,enoent} = Mod:read_file("åäö_fil1"), - ?line Mod:rename("åäö2",treat_icky(<<"åäö_fil1">>)), - ?line {ok, <<"åäö2">>} = Mod:read_file(treat_icky(<<"åäö_fil1">>)), + Mod:rename("åäö2",treat_icky(<<"åäö_fil1">>)), + {ok, <<"åäö2">>} = Mod:read_file(treat_icky(<<"åäö_fil1">>)), if UniMode and (OS =/= win32) -> {error,enoent} = Mod:read_file("åäö_fil1"); true -> ok end, - ?line {error,enoent} = Mod:read_file("åäö2"), - ?line Mod:rename(treat_icky(<<"åäö_fil1">>),"åäö2"), - ?line {ok, <<"åäö2">>} = Mod:read_file("åäö2"), - ?line {error,enoent} = Mod:read_file("åäö_fil1"), - ?line {error,enoent} = Mod:read_file(treat_icky(<<"åäö_fil1">>)), + {error,enoent} = Mod:read_file("åäö2"), + Mod:rename(treat_icky(<<"åäö_fil1">>),"åäö2"), + {ok, <<"åäö2">>} = Mod:read_file("åäö2"), + {error,enoent} = Mod:read_file("åäö_fil1"), + {error,enoent} = Mod:read_file(treat_icky(<<"åäö_fil1">>)), - ?line {ok,FI} = Mod:read_file_info("åäö2"), - ?line NewMode = FI#file_info.mode band (bnot 8#333), - ?line NewMode2 = NewMode bor 8#222, - ?line true = NewMode2 =/= NewMode, - ?line ok = Mod:write_file_info("åäö2",FI#file_info{mode = NewMode}), - ?line {ok,#file_info{mode = NewMode}} = Mod:read_file_info("åäö2"), - ?line ok = Mod:write_file_info("åäö2",FI#file_info{mode = NewMode2}), - ?line {ok,#file_info{mode = NewMode2}} = Mod:read_file_info("åäö2"), + {ok,FI} = Mod:read_file_info("åäö2"), + NewMode = FI#file_info.mode band (bnot 8#333), + NewMode2 = NewMode bor 8#222, + true = NewMode2 =/= NewMode, + ok = Mod:write_file_info("åäö2",FI#file_info{mode = NewMode}), + {ok,#file_info{mode = NewMode}} = Mod:read_file_info("åäö2"), + ok = Mod:write_file_info("åäö2",FI#file_info{mode = NewMode2}), + {ok,#file_info{mode = NewMode2}} = Mod:read_file_info("åäö2"), - ?line {ok,FII} = Mod:read_file_info(treat_icky(<<"åäö5">>)), - ?line true = NewMode2 =/= NewMode, - ?line ok = Mod:write_file_info(treat_icky(<<"åäö5">>),FII#file_info{mode = NewMode}), - ?line {ok,#file_info{mode = NewMode}} = Mod:read_file_info(treat_icky(<<"åäö5">>)), - ?line ok = Mod:write_file_info(<<"åäö5">>,FII#file_info{mode = NewMode2}), - ?line {ok,#file_info{mode = NewMode2}} = Mod:read_file_info(treat_icky(<<"åäö5">>)), + {ok,FII} = Mod:read_file_info(treat_icky(<<"åäö5">>)), + true = NewMode2 =/= NewMode, + ok = Mod:write_file_info(treat_icky(<<"åäö5">>),FII#file_info{mode = NewMode}), + {ok,#file_info{mode = NewMode}} = Mod:read_file_info(treat_icky(<<"åäö5">>)), + ok = Mod:write_file_info(<<"åäö5">>,FII#file_info{mode = NewMode2}), + {ok,#file_info{mode = NewMode2}} = Mod:read_file_info(treat_icky(<<"åäö5">>)), ok after Mod:set_cwd(Dir), @@ -463,90 +463,90 @@ check_icky(Mod) -> check_very_icky(Mod) -> {ok,Dir} = Mod:get_cwd(), try - ?line true=(length("åäö") =:= 3), - ?line UniMode = file:native_name_encoding() =/= latin1, + true=(length("åäö") =:= 3), + UniMode = file:native_name_encoding() =/= latin1, if not UniMode -> throw(need_unicode_mode); true -> ok end, - ?line make_very_icky_dir(Mod), + make_very_icky_dir(Mod), {ok, L0} = Mod:list_dir_all("."), - ?line L1 = lists:sort(L0), - ?line L1 = lists:sort(convlist(list(very_icky_dir()))), - ?line {ok,D2} = Mod:get_cwd(), - ?line true = is_list(D2), - ?line [ true = ((is_list(El) or is_binary(El))) || El <- L1], - ?line Syms = [ {S,conv(Targ),list_to_binary(get_data(Targ,very_icky_dir()))} + L1 = lists:sort(L0), + L1 = lists:sort(convlist(list(very_icky_dir()))), + {ok,D2} = Mod:get_cwd(), + true = is_list(D2), + [ true = ((is_list(El) or is_binary(El))) || El <- L1], + Syms = [ {S,conv(Targ),list_to_binary(get_data(Targ,very_icky_dir()))} || {T,S,Targ} <- very_icky_dir(), T =:= symlink ], - ?line [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ], - ?line [ {ok, Targ} = fixlink(Mod:read_link_all(SymL)) || - {SymL,Targ,_} <- Syms ], - ?line chk_cre_dir(Mod,[{directory,[1088,1079,1091]++"_dir",very_icky_dir()}]), - ?line {ok,BeginAt} = Mod:get_cwd(), - ?line true = is_list(BeginAt), - ?line {error,enoent} = Mod:set_cwd("åä_dir"), - ?line ok = Mod:set_cwd([1088,1079,1091]++"_dir"), - ?line {ok, NowAt} = Mod:get_cwd(), - ?line true = is_list(NowAt), - ?line true = BeginAt =/= NowAt, - ?line ok = Mod:set_cwd(".."), - ?line {ok,BeginAt} = Mod:get_cwd(), - ?line rm_r2(Mod,[1088,1079,1091]++"_dir"), + [ {ok, Cont} = Mod:read_file(SymL) || {SymL,_,Cont} <- Syms ], + [ {ok, Targ} = fixlink(Mod:read_link_all(SymL)) || + {SymL,Targ,_} <- Syms ], + chk_cre_dir(Mod,[{directory,[1088,1079,1091]++"_dir",very_icky_dir()}]), + {ok,BeginAt} = Mod:get_cwd(), + true = is_list(BeginAt), + {error,enoent} = Mod:set_cwd("åä_dir"), + ok = Mod:set_cwd([1088,1079,1091]++"_dir"), + {ok, NowAt} = Mod:get_cwd(), + true = is_list(NowAt), + true = BeginAt =/= NowAt, + ok = Mod:set_cwd(".."), + {ok,BeginAt} = Mod:get_cwd(), + rm_r2(Mod,[1088,1079,1091]++"_dir"), case has_links() of true -> - ?line ok = Mod:make_link("fil1","nisse"++[1088,1079,1091]), - ?line {ok, <<"fil1">>} = + ok = Mod:make_link("fil1","nisse"++[1088,1079,1091]), + {ok, <<"fil1">>} = Mod:read_file("nisse"++[1088,1079,1091]), - ?line {ok, #file_info{type = regular}} = + {ok, #file_info{type = regular}} = Mod:read_link_info("nisse"++[1088,1079,1091]), - ?line ok = Mod:delete("nisse"++[1088,1079,1091]), - ?line ok = Mod:make_link("fil1",<<"nisseö">>), - ?line {ok, <<"fil1">>} = Mod:read_file(<<"nisseö">>), - ?line {ok, #file_info{type = regular}} = + ok = Mod:delete("nisse"++[1088,1079,1091]), + ok = Mod:make_link("fil1",<<"nisseö">>), + {ok, <<"fil1">>} = Mod:read_file(<<"nisseö">>), + {ok, #file_info{type = regular}} = Mod:read_link_info(<<"nisseö">>), - ?line ok = Mod:delete(<<"nisseö">>), - ?line {ok, <<"fil1">>} = Mod:read_file("fil1"), - ?line {error,enoent} = Mod:read_file("nisse"++[1088,1079,1091]), - ?line {error,enoent} = Mod:read_link_info("nisse"++[1088,1079,1091]), - ?line {error,enoent} = Mod:read_file(<<"nisseö">>), - ?line {error,enoent} = Mod:read_link_info(<<"nisseö">>); + ok = Mod:delete(<<"nisseö">>), + {ok, <<"fil1">>} = Mod:read_file("fil1"), + {error,enoent} = Mod:read_file("nisse"++[1088,1079,1091]), + {error,enoent} = Mod:read_link_info("nisse"++[1088,1079,1091]), + {error,enoent} = Mod:read_file(<<"nisseö">>), + {error,enoent} = Mod:read_link_info(<<"nisseö">>); false -> ok end, - ?line [ begin - ?line {ok, FD} = Mod:open(Name,[read]), - ?line {ok, Content} = Mod:read(FD,1024), - ?line ok = file:close(FD) + [ begin + {ok, FD} = Mod:open(Name,[read]), + {ok, Content} = Mod:read(FD,1024), + ok = file:close(FD) end || {regular,Name,Content} <- very_icky_dir() ], - ?line [ begin - ?line {ok, FD} = Mod:open(Name,[read,binary]), - ?line BC = list_to_binary([Content]), - ?line {ok, BC} = Mod:read(FD,1024), - ?line ok = file:close(FD) + [ begin + {ok, FD} = Mod:open(Name,[read,binary]), + BC = list_to_binary([Content]), + {ok, BC} = Mod:read(FD,1024), + ok = file:close(FD) end || {regular,Name,Content} <- very_icky_dir() ], - ?line Mod:rename([956,965,963,954,959,49], - [956,965,963,954,959]++"_fil1"), - ?line {ok, <<"åäö2">>} = Mod:read_file([956,965,963,954,959]++"_fil1"), - ?line {error,enoent} = Mod:read_file([956,965,963,954,959,49]), - ?line Mod:rename([956,965,963,954,959]++"_fil1",[956,965,963,954,959,49]), - ?line {ok, <<"åäö2">>} = Mod:read_file([956,965,963,954,959,49]), - ?line {error,enoent} = Mod:read_file([956,965,963,954,959]++"_fil1"), + Mod:rename([956,965,963,954,959,49], + [956,965,963,954,959]++"_fil1"), + {ok, <<"åäö2">>} = Mod:read_file([956,965,963,954,959]++"_fil1"), + {error,enoent} = Mod:read_file([956,965,963,954,959,49]), + Mod:rename([956,965,963,954,959]++"_fil1",[956,965,963,954,959,49]), + {ok, <<"åäö2">>} = Mod:read_file([956,965,963,954,959,49]), + {error,enoent} = Mod:read_file([956,965,963,954,959]++"_fil1"), - ?line {ok,FI} = Mod:read_file_info([956,965,963,954,959,49]), - ?line NewMode = FI#file_info.mode band (bnot 8#333), - ?line NewMode2 = NewMode bor 8#222, - ?line true = NewMode2 =/= NewMode, - ?line ok = Mod:write_file_info([956,965,963,954,959,49], - FI#file_info{mode = NewMode}), - ?line {ok,#file_info{mode = NewMode}} = - Mod:read_file_info([956,965,963,954,959,49]), - ?line ok = Mod:write_file_info([956,965,963,954,959,49], - FI#file_info{mode = NewMode2}), - ?line {ok,#file_info{mode = NewMode2}} = - Mod:read_file_info([956,965,963,954,959,49]), + {ok,FI} = Mod:read_file_info([956,965,963,954,959,49]), + NewMode = FI#file_info.mode band (bnot 8#333), + NewMode2 = NewMode bor 8#222, + true = NewMode2 =/= NewMode, + ok = Mod:write_file_info([956,965,963,954,959,49], + FI#file_info{mode = NewMode}), + {ok,#file_info{mode = NewMode}} = + Mod:read_file_info([956,965,963,954,959,49]), + ok = Mod:write_file_info([956,965,963,954,959,49], + FI#file_info{mode = NewMode2}), + {ok,#file_info{mode = NewMode2}} = + Mod:read_file_info([956,965,963,954,959,49]), ok catch throw:need_unicode_mode -> @@ -629,7 +629,7 @@ chk_cre_dir(Mod,[{directory,Name,Content}|T]) -> %% io:format("Content2 = ~p~n",[Content2]), chk_cre_dir(Mod,Content2), chk_cre_dir(Mod,T). - + has_links() -> case os:type() of {win32,_} -> @@ -659,7 +659,7 @@ make_normal_dir(Mod) -> Mod:make_dir("subdir"), Mod:write_file(filename:join("subdir","subfil1"),"subfil1"), ok. - + normal_dir() -> [{regular,"fil1","fil1"}, {regular,"fil2","fil2"}] ++ @@ -714,12 +714,12 @@ icky_dir() -> [] end ++ [{regular,treat_icky(<<"åäö5">>),"åäö5"}] ++ - case has_links() of - true -> - [{symlink,treat_icky(<<"åäö6">>),treat_icky(<<"åäö5">>)}]; - false -> - [] - end ++ + case has_links() of + true -> + [{symlink,treat_icky(<<"åäö6">>),treat_icky(<<"åäö5">>)}]; + false -> + [] + end ++ [{directory,treat_icky(<<"åäösubdir2">>), [{regular,treat_icky(<<"åäösubfil2">>),"åäösubfil12"}, {regular,"åäösubfil3","åäösubfil13"}]}, @@ -743,18 +743,18 @@ very_icky_dir() -> false -> [] end ++ - [{regular,treat_icky(<<"åäö5">>),"åäö5"}] ++ + [{regular,treat_icky(<<"åäö5">>),"åäö5"}] ++ case has_links() of true -> [{symlink,treat_icky(<<"åäö6">>),treat_icky(<<"åäö5">>)}]; false -> [] end ++ - [{directory,treat_icky(<<"åäösubdir2">>), - [{regular,treat_icky(<<"åäösubfil2">>),"åäösubfil12"}, - {regular,"åäösubfil3","åäösubfil13"}]}, - {directory,[956,965,963,954,959]++"subdir1", - [{regular,[956,965,963,954,959]++"subfil1","åäösubfil1"}]}]. + [{directory,treat_icky(<<"åäösubdir2">>), + [{regular,treat_icky(<<"åäösubfil2">>),"åäösubfil12"}, + {regular,"åäösubfil3","åäösubfil13"}]}, + {directory,[956,965,963,954,959]++"subdir1", + [{regular,[956,965,963,954,959]++"subfil1","åäösubfil1"}]}]. %% Some OS'es simply do not allow non UTF8 filenames treat_icky(Bin) -> @@ -794,7 +794,7 @@ list([]) -> []; list([{_,Name,_} | T]) -> [Name | list(T)]. - + get_data(FN,List) -> case lists:keysearch(FN,2,List) of @@ -834,7 +834,7 @@ rand_comp_decomp(Max) -> LD = lists:flatten([B || {_,B} <- L]), LB = unicode:characters_to_binary(LD,unicode,utf8), {LC,LB}. - + rand_decomp() -> BT = bigtup(), SZ = tuple_size(BT), |