aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2014-03-25 12:13:27 +0100
committerHans Nilsson <[email protected]>2014-03-25 12:13:27 +0100
commite6e095de8cf834269fa5936221222363144eb47f (patch)
treee6adc9c918ab6f8f4857873cebd25e4246ad6404
parent62430f5399c31b1be0a4737cff680b8d4122f41e (diff)
parent5182dd0da07cd4940bfa23c739da1a5d1fdbaf72 (diff)
downloadotp-e6e095de8cf834269fa5936221222363144eb47f.tar.gz
otp-e6e095de8cf834269fa5936221222363144eb47f.tar.bz2
otp-e6e095de8cf834269fa5936221222363144eb47f.zip
Merge branch 'hans/eldap/asn1_bin_lists/OTP-11768'
* hans/eldap/asn1_bin_lists/OTP-11768: eldap: Fix asn.1 decode into binaries
-rw-r--r--lib/eldap/src/Makefile2
-rw-r--r--lib/eldap/test/eldap_misc_SUITE.erl51
2 files changed, 52 insertions, 1 deletions
diff --git a/lib/eldap/src/Makefile b/lib/eldap/src/Makefile
index ebb7967e11..2e1110ec2c 100644
--- a/lib/eldap/src/Makefile
+++ b/lib/eldap/src/Makefile
@@ -88,7 +88,7 @@ $(TARGET_FILES): $(HRL_FILES)
# Special Build Targets
# ----------------------------------------------------
$(ASN1_HRL): ../asn1/$(ASN1_FILES)
- $(asn_verbose)$(ERLC) -o $(EBIN) -bber $(ERL_COMPILE_FLAGS) ../asn1/ELDAPv3.asn1
+ $(asn_verbose)$(ERLC) -o $(EBIN) +legacy_erlang_types -bber $(ERL_COMPILE_FLAGS) ../asn1/ELDAPv3.asn1
# ----------------------------------------------------
# Release Target
diff --git a/lib/eldap/test/eldap_misc_SUITE.erl b/lib/eldap/test/eldap_misc_SUITE.erl
new file mode 100644
index 0000000000..ca810ee33c
--- /dev/null
+++ b/lib/eldap/test/eldap_misc_SUITE.erl
@@ -0,0 +1,51 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2012-2014. All Rights Reserved.
+%%
+%% The contents of this file are subject to the Erlang Public License,
+%% Version 1.1, (the "License"); you may not use this file except in
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+
+-module(eldap_misc_SUITE).
+
+-compile(export_all). %% Use this only in test suites...
+
+-include_lib("common_test/include/ct.hrl").
+-include_lib("eldap/include/eldap.hrl").
+-include_lib("eldap/ebin/ELDAPv3.hrl").
+
+all() ->
+ [
+ encode,
+ decode
+ ].
+
+
+encode(_Config) ->
+ {ok,Bin} = 'ELDAPv3':encode('AddRequest', #'AddRequest'{entry="hejHopp" ,attributes=[]} ),
+ Expected = <<104,11,4,7,104,101,106,72,111,112,112,48,0>>,
+ Expected = Bin.
+
+decode(_Config) ->
+ {ok,Res} = 'ELDAPv3':decode('AddRequest', <<104,11,4,7,104,101,106,72,111,112,112,48,0>>),
+ ct:log("Res = ~p", [Res]),
+ Expected = #'AddRequest'{entry = "hejHopp",attributes = []},
+ case Res of
+ Expected -> ok;
+ #'AddRequest'{entry= <<"hejHopp">>, attributes=[]} ->
+ {fail, "decoded to (correct) binary!!"};
+ _ ->
+ {fail, "Bad decode"}
+ end.
+