aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test/test_modified_x420.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-02-04 12:10:50 +0100
committerBjörn Gustavsson <[email protected]>2013-02-04 16:25:42 +0100
commit10c73156d654bc1ada7afbc3cd7f81b2091057f0 (patch)
treed03c8216c83a08491c9dbf3f540566a73549efcb /lib/asn1/test/test_modified_x420.erl
parente7cc9b2e81128632d3cd0a1d357527b7f5faa5f8 (diff)
downloadotp-10c73156d654bc1ada7afbc3cd7f81b2091057f0.tar.gz
otp-10c73156d654bc1ada7afbc3cd7f81b2091057f0.tar.bz2
otp-10c73156d654bc1ada7afbc3cd7f81b2091057f0.zip
asn1_SUITE: Mend broken test_modified_x420/1
The test_modified_x420/1 test case had several problems that prevented it to detect the bugs it was supposed to find: 1) There was a 'catch' at the top-level so that it could never fail. 2) There was a call to the now non-existing ssl_base64 module. 3) It did not test all options for the BER backend. While at it, also clean way the remaining ?line macros and some out-commented code.
Diffstat (limited to 'lib/asn1/test/test_modified_x420.erl')
-rw-r--r--lib/asn1/test/test_modified_x420.erl22
1 files changed, 8 insertions, 14 deletions
diff --git a/lib/asn1/test/test_modified_x420.erl b/lib/asn1/test/test_modified_x420.erl
index 2e9dfeee87..ae9d1989fb 100644
--- a/lib/asn1/test/test_modified_x420.erl
+++ b/lib/asn1/test/test_modified_x420.erl
@@ -18,27 +18,21 @@
%%
%%
-module(test_modified_x420).
-
-%-compile(export_all).
--export([test_io/1]).
+-export([test/1]).
-include_lib("test_server/include/test_server.hrl").
-test_io(Config) ->
- io:format("~p~n~n", [catch test(Config)]).
-
test(Config) ->
- ?line DataDir = ?config(data_dir,Config),
-% ?line OutDir = ?config(priv_dir,Config),
+ DataDir = ?config(data_dir,Config),
- ?line Der = read_pem(filename:join([DataDir,modified_x420,"p7_signed_data.pem"])),
- ?line {ok, {_,_,SignedData}} = 'PKCS7':decode('ContentInfo', Der),
- ?line {ok,_} = 'PKCS7':decode('SignedData', SignedData).
+ Der = read_pem(filename:join([DataDir,modified_x420,"p7_signed_data.pem"])),
+ {ok,{_,_,SignedData}} = asn1_wrapper:decode('PKCS7', 'ContentInfo', Der),
+ {ok,_} = asn1_wrapper:decode('PKCS7', 'SignedData', SignedData).
read_pem(File) ->
- ?line {ok, Bin} = file:read_file(File),
- ?line ssl_base64:join_decode(lists:flatten(extract_base64(Bin))).
-
+ {ok,Bin} = file:read_file(File),
+ Der = base64:mime_decode(lists:flatten(extract_base64(Bin))),
+ binary_to_list(Der).
extract_base64(Binary) ->