diff options
author | Magnus Lång <[email protected]> | 2014-03-26 18:58:46 +0100 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2014-04-29 11:40:29 +0200 |
commit | 5a43eb383bdeb604fd8a891ffe34610c3fe6208b (patch) | |
tree | 1a76c9a5bf0d8f32c06acb8266eaa52ce6e860d5 /lib/hipe/test/maps_SUITE_data/maps_guard_fun.erl | |
parent | e486d8b0c6124f39db6fa600f348c7bd5c0c1a13 (diff) | |
download | otp-5a43eb383bdeb604fd8a891ffe34610c3fe6208b.tar.gz otp-5a43eb383bdeb604fd8a891ffe34610c3fe6208b.tar.bz2 otp-5a43eb383bdeb604fd8a891ffe34610c3fe6208b.zip |
Copy the tests for maps from the compiler application to a new HiPE test suite
Change the maps_guard_fun test to accept the HiPE trace format.
Diffstat (limited to 'lib/hipe/test/maps_SUITE_data/maps_guard_fun.erl')
-rw-r--r-- | lib/hipe/test/maps_SUITE_data/maps_guard_fun.erl | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/hipe/test/maps_SUITE_data/maps_guard_fun.erl b/lib/hipe/test/maps_SUITE_data/maps_guard_fun.erl new file mode 100644 index 0000000000..9f6eb3a04e --- /dev/null +++ b/lib/hipe/test/maps_SUITE_data/maps_guard_fun.erl @@ -0,0 +1,36 @@ +-module(maps_guard_fun). +-export([test/0]). + +test() -> + F1 = fun + (#{s:=v,v:=V}) -> {v,V}; + (#{s:=t,v:={V,V}}) -> {t,V}; + (#{s:=l,v:=[V,V]}) -> {l,V} + end, + + F2 = fun + (#{s:=T,v:={V,V}}) -> {T,V}; + (#{s:=T,v:=[V,V]}) -> {T,V}; + (#{s:=T,v:=V}) -> {T,V} + end, + V = <<"hi">>, + + {v,V} = F1(#{s=>v,v=>V}), + {t,V} = F1(#{s=>t,v=>{V,V}}), + {l,V} = F1(#{s=>l,v=>[V,V]}), + + {v,V} = F2(#{s=>v,v=>V}), + {t,V} = F2(#{s=>t,v=>{V,V}}), + {l,V} = F2(#{s=>l,v=>[V,V]}), + + %% error case + case (catch F1(#{s=>none,v=>none})) of + {'EXIT', {function_clause,[{?MODULE,_,[#{s:=none,v:=none}],_}|_]}} -> ok; + {'EXIT', {function_clause,[{?MODULE,_,1,[#{s:=none,v:=none}]}|_]}} -> ok; + {'EXIT', {function_clause,[Frame|_]}} + when is_tuple(Frame), element(1, Frame) =:= ?MODULE -> + test_server:comment("Unexpected trace format, probably using HiPE"); + {'EXIT', {{case_clause,_},_}} -> {comment,inlined}; + Other -> + test_server:fail({no_match, Other}) + end. |