diff options
Diffstat (limited to 'lib/asn1/test/test_compile_options.erl')
-rw-r--r-- | lib/asn1/test/test_compile_options.erl | 83 |
1 files changed, 40 insertions, 43 deletions
diff --git a/lib/asn1/test/test_compile_options.erl b/lib/asn1/test/test_compile_options.erl index 1af614f49a..ea67514229 100644 --- a/lib/asn1/test/test_compile_options.erl +++ b/lib/asn1/test/test_compile_options.erl @@ -39,50 +39,49 @@ wrong_path(Config) -> end. comp(Parent,Config) -> - DataDir = ?config(data_dir,Config), - OutDir = ?config(priv_dir,Config), - ?line Err=asn1ct:compile(DataDir++"NoImport",[{i,OutDir},{i,filename:join([DataDir,"subdir"])},{outdir,OutDir}]), + DataDir = proplists:get_value(data_dir,Config), + OutDir = proplists:get_value(priv_dir,Config), + Err=asn1ct:compile(DataDir++"NoImport",[{i,OutDir},{i,filename:join([DataDir,"subdir"])},{outdir,OutDir}]), Parent!Err. %% OTP-5701 path(Config) -> - DataDir = ?config(data_dir,Config), - OutDir = ?config(priv_dir,Config), + DataDir = proplists:get_value(data_dir,Config), + OutDir = proplists:get_value(priv_dir,Config), {ok,CWD} = file:get_cwd(), - ?line file:set_cwd(filename:join([DataDir,subdir])), + file:set_cwd(filename:join([DataDir,subdir])), ok = asn1ct:compile("../MyMerge.set.asn",[{outdir,OutDir}]), - ?line ok=outfiles_check(OutDir), - ?line outfiles_remove(OutDir), + ok=outfiles_check(OutDir), + outfiles_remove(OutDir), file:set_cwd(filename:join([DataDir,subdir,subsubdir])), ok = asn1ct:compile('../../MyMerge.set.asn',[{i,'..'},{outdir,OutDir}]), - ?line ok=outfiles_check(OutDir,outfiles2()), + ok=outfiles_check(OutDir,outfiles2()), file:set_cwd(CWD), ok. ticket_6143(Config) -> asn1_test_lib:compile("AA1", Config, []). noobj(Config) -> - DataDir = ?config(data_dir,Config), - OutDir = ?config(priv_dir,Config), + DataDir = proplists:get_value(data_dir,Config), + OutDir = proplists:get_value(priv_dir,Config), code:purge('P-Record'), file:delete(filename:join([OutDir,'P-Record.erl'])), file:delete(filename:join([OutDir,'P-Record.beam'])), - ?line ok=asn1ct:compile(filename:join([DataDir,"P-Record"]), + ok=asn1ct:compile(filename:join([DataDir,"P-Record"]), [noobj,{outdir,OutDir}]), -% ?line false = code:is_loaded('P-Record'), - ?line {ok,_} = file:read_file_info(filename:join([OutDir, + {ok,_} = file:read_file_info(filename:join([OutDir, "P-Record.erl"])), - ?line {error,enoent} = + {error,enoent} = file:read_file_info(filename:join([OutDir,"P-Record.beam"])), - ?line {ok,_} = c:c(filename:join([OutDir,'P-Record']), + {ok,_} = c:c(filename:join([OutDir,'P-Record']), [{i,OutDir},{outdir,OutDir}]), - ?line {file,_} = code:is_loaded('P-Record'), + {file,_} = code:is_loaded('P-Record'), code:purge('P-Record'), code:delete('P-Record'), @@ -94,43 +93,41 @@ noobj(Config) -> file:delete(filename:join([OutDir,'p_record.beam'])), ok = asn1ct:compile(filename:join([DataDir,"p_record.set.asn"]), [asn1config,ber,noobj,{outdir,OutDir}]), -%% ?line false = code:is_loaded('P-Record'), -%% ?line false = code:is_loaded('p_record'), - ?line {error,enoent} = + {error,enoent} = file:read_file_info(filename:join([OutDir,"P-Record.beam"])), - ?line {error,enoent} = + {error,enoent} = file:read_file_info(filename:join([OutDir,"P-Record.erl"])), - ?line {error,enoent} = + {error,enoent} = file:read_file_info(filename:join([OutDir,"p_record.beam"])), io:format("read_file_info: p_record.erl~n",[]), - ?line {ok,_} = + {ok,_} = file:read_file_info(filename:join([OutDir,"p_record.erl"])), io:format("c:c: p_record.erl~n",[]), - ?line {ok,_} = c:c(filename:join([OutDir,'p_record']), + {ok,_} = c:c(filename:join([OutDir,'p_record']), [{i,OutDir},{outdir,OutDir}]), io:format("code:is_loaded: p_record.erl~n",[]), - ?line {file,_} = code:is_loaded('p_record'), + {file,_} = code:is_loaded('p_record'), io:format("file:delete: p_record.erl~n",[]), file:delete(filename:join([OutDir,'p_record.erl'])), file:delete(filename:join([OutDir,'p_record.beam'])). verbose(Config) when is_list(Config) -> - DataDir = ?config(data_dir,Config), - OutDir = ?config(priv_dir,Config), + DataDir = proplists:get_value(data_dir,Config), + OutDir = proplists:get_value(priv_dir,Config), Asn1File = filename:join([DataDir,"Comment.asn"]), %% Test verbose compile - ?line test_server:capture_start(), - ?line ok = asn1ct:compile(Asn1File, [{i,DataDir},{outdir,OutDir},noobj,verbose]), - ?line test_server:capture_stop(), - ?line [Line0|_] = test_server:capture_get(), - ?line true = lists:prefix("Erlang ASN.1 compiler", Line0), + test_server:capture_start(), + ok = asn1ct:compile(Asn1File, [{i,DataDir},{outdir,OutDir},noobj,verbose]), + test_server:capture_stop(), + [Line0|_] = test_server:capture_get(), + true = lists:prefix("Erlang ASN.1 compiler", Line0), %% Test non-verbose compile - ?line test_server:capture_start(), - ?line ok = asn1ct:compile(Asn1File, [{i,DataDir},{outdir,OutDir},noobj]), - ?line test_server:capture_stop(), - ?line [] = test_server:capture_get(), + test_server:capture_start(), + ok = asn1ct:compile(Asn1File, [{i,DataDir},{outdir,OutDir},noobj]), + test_server:capture_stop(), + [] = test_server:capture_get(), ok. outfiles_check(OutDir) -> @@ -141,7 +138,7 @@ outfiles_check(_OutDir,[])-> ok; outfiles_check(OutDir,[H|T]) -> io:format("File: ~p~n",[filename:join([OutDir,H])]), - ?line {ok,_}=file:read_file_info(filename:join([OutDir,H])), + {ok,_}=file:read_file_info(filename:join([OutDir,H])), outfiles_check(OutDir,T). outfiles1() -> @@ -155,8 +152,8 @@ outfiles_remove(OutDir) -> outfiles1()). record_name_prefix(Config) -> - DataDir = ?config(data_dir,Config), - OutDir = ?config(priv_dir,Config), + DataDir = proplists:get_value(data_dir,Config), + OutDir = proplists:get_value(priv_dir,Config), ok = b_SeqIn(DataDir,OutDir), ok = a_SeqIn(DataDir,OutDir). @@ -165,15 +162,15 @@ b_SeqIn(DataDir,OutDir) -> [{record_name_prefix,"b_"},{outdir,OutDir}]), io:format("FileName: ~p~nOutDir:~p~n", [filename:join([DataDir,'b_SeqIn']),OutDir]), - ?line {ok,_} = compile:file(filename:join([DataDir,'b_SeqIn']), + {ok,_} = compile:file(filename:join([DataDir,'b_SeqIn']), [{i,OutDir}]), - ?line 'b_SeqIn' = b_SeqIn:record_name(), + 'b_SeqIn' = b_SeqIn:record_name(), ok. a_SeqIn(DataDir,OutDir) -> asn1ct:compile(filename:join([DataDir,'Seq']), [{record_name_prefix,"a_"},{outdir,OutDir}]), - ?line {ok,_} = compile:file(filename:join([DataDir,'a_SeqIn']), + {ok,_} = compile:file(filename:join([DataDir,'a_SeqIn']), [{i,OutDir}]), - ?line 'a_SeqIn' = a_SeqIn:record_name(), + 'a_SeqIn' = a_SeqIn:record_name(), ok. |