aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/test/asn1_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-09-24 10:28:16 +0200
committerBjörn Gustavsson <[email protected]>2013-09-27 10:44:49 +0200
commit0f430abcb189988a7faf55386557b2b74afa6f56 (patch)
tree71915a21f54b442c32fcfbc880872cc7c98b6561 /lib/asn1/test/asn1_SUITE.erl
parente5210c4bc75f561383ec4f94e3dce15440f1c269 (diff)
downloadotp-0f430abcb189988a7faf55386557b2b74afa6f56.tar.gz
otp-0f430abcb189988a7faf55386557b2b74afa6f56.tar.bz2
otp-0f430abcb189988a7faf55386557b2b74afa6f56.zip
Teach the ASN.1 compiler the no_ok_wrapper option
Add the no_ok_wrapper option so that the generated M:encode/2 and M:decode/2 functions will not wrap a successful return value in an {ok,...} tuple. Errors will cause exceptions. Eliminating the wrapping tuple allows simpler nesting of calls.
Diffstat (limited to 'lib/asn1/test/asn1_SUITE.erl')
-rw-r--r--lib/asn1/test/asn1_SUITE.erl20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/asn1/test/asn1_SUITE.erl b/lib/asn1/test/asn1_SUITE.erl
index a558a2941f..61b360ddf2 100644
--- a/lib/asn1/test/asn1_SUITE.erl
+++ b/lib/asn1/test/asn1_SUITE.erl
@@ -297,7 +297,15 @@ cover(_) ->
testPrim(Config) -> test(Config, fun testPrim/3).
testPrim(Config, Rule, Opts) ->
- asn1_test_lib:compile_all(["Prim", "Real"], Config, [Rule|Opts]),
+ Files = ["Prim","Real"],
+ asn1_test_lib:compile_all(Files, Config, [Rule|Opts]),
+ do_test_prim(Rule, false),
+ asn1_test_lib:compile_all(Files, Config, [no_ok_wrapper,Rule|Opts]),
+ do_test_prim(Rule, true).
+
+do_test_prim(Rule, NoOkWrapper) ->
+ io:format("No ok wrapper: ~p\n", [NoOkWrapper]),
+ put(no_ok_wrapper, NoOkWrapper),
testPrim:bool(Rule),
testPrim:int(Rule),
testPrim:enum(Rule),
@@ -925,10 +933,14 @@ testNortel(Config, Rule, Opts) ->
test_undecoded_rest(Config) -> test(Config, fun test_undecoded_rest/3).
test_undecoded_rest(Config, Rule, Opts) ->
+ do_test_undecoded_rest(Config, Rule, Opts),
+ do_test_undecoded_rest(Config, Rule, [no_ok_wrapper|Opts]),
+ do_test_undecoded_rest(Config, Rule, [undec_rest|Opts]),
+ do_test_undecoded_rest(Config, Rule, [no_ok_wrapper,undec_rest|Opts]).
+
+do_test_undecoded_rest(Config, Rule, Opts) ->
asn1_test_lib:compile("P-Record", Config, [Rule|Opts]),
- ok = test_undecoded_rest:test([], Config),
- asn1_test_lib:compile("P-Record", Config, [Rule,undec_rest|Opts]),
- test_undecoded_rest:test(undec_rest, Config).
+ test_undecoded_rest:test(Opts, Config).
testTcapsystem(Config) ->
test(Config, fun testTcapsystem/3).