diff options
author | Kostis Sagonas <[email protected]> | 2014-04-29 12:14:19 +0200 |
---|---|---|
committer | Kostis Sagonas <[email protected]> | 2014-04-29 12:14:19 +0200 |
commit | f6d5234c391a0ba834337c3e92ee5fb377834a32 (patch) | |
tree | b046b684620ca9eab0e3f880a7ee34c1e6397d17 /lib/hipe/test/maps_SUITE_data/maps_get_map_elements.erl | |
parent | 5a43eb383bdeb604fd8a891ffe34610c3fe6208b (diff) | |
download | otp-f6d5234c391a0ba834337c3e92ee5fb377834a32.tar.gz otp-f6d5234c391a0ba834337c3e92ee5fb377834a32.tar.bz2 otp-f6d5234c391a0ba834337c3e92ee5fb377834a32.zip |
Add five new test files for maps in the HiPE test suite
Diffstat (limited to 'lib/hipe/test/maps_SUITE_data/maps_get_map_elements.erl')
-rw-r--r-- | lib/hipe/test/maps_SUITE_data/maps_get_map_elements.erl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/hipe/test/maps_SUITE_data/maps_get_map_elements.erl b/lib/hipe/test/maps_SUITE_data/maps_get_map_elements.erl new file mode 100644 index 0000000000..b2d749796a --- /dev/null +++ b/lib/hipe/test/maps_SUITE_data/maps_get_map_elements.erl @@ -0,0 +1,23 @@ +%% -*- erlang-indent-level: 2 -*- +%%------------------------------------------------------------------------- +-module(maps_get_map_elements). + +-export([test/0]). + +test() -> + {A, B} = id({"hej", <<123>>}), + Map = maps:from_list([{a, A}, {b, B}]), + #{a := A, b := B} = id(Map), + false = test_pattern(Map), + true = test_pattern(#{b => 1, a => "hej"}), + case Map of + #{a := C, b := <<124>>} -> yay; + _ -> C = B, nay + end, + C = id(B), + ok. + +id(X) -> X. + +test_pattern(#{a := _, b := 1}) -> true; +test_pattern(#{}) -> false. |