aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test/map_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-03-23 10:07:21 +0100
committerBjörn Gustavsson <[email protected]>2015-04-13 12:37:54 +0200
commitcd4c3e3bc699e73a7bada55a74333e5a09c7f9e4 (patch)
treebcd49a59910310fd9f06f0da6031c04564108dfc /lib/compiler/test/map_SUITE.erl
parenta1e409e082392fcb8dc8131b77851d72551711a5 (diff)
downloadotp-cd4c3e3bc699e73a7bada55a74333e5a09c7f9e4.tar.gz
otp-cd4c3e3bc699e73a7bada55a74333e5a09c7f9e4.tar.bz2
otp-cd4c3e3bc699e73a7bada55a74333e5a09c7f9e4.zip
map_SUITE: Add tests of is_map/1 with literal maps
To be sure that the compiler and BEAM virtual machine correctly handles literals maps, we must test it.
Diffstat (limited to 'lib/compiler/test/map_SUITE.erl')
-rw-r--r--lib/compiler/test/map_SUITE.erl13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl
index 8870315084..7db467a0d2 100644
--- a/lib/compiler/test/map_SUITE.erl
+++ b/lib/compiler/test/map_SUITE.erl
@@ -37,6 +37,7 @@
t_map_sort_literals/1,
t_map_size/1,
t_build_and_match_aliasing/1,
+ t_is_map/1,
%% variables
t_build_and_match_variables/1,
@@ -84,6 +85,7 @@ all() ->
t_map_sort_literals,
t_map_size,
t_build_and_match_aliasing,
+ t_is_map,
%% variables
t_build_and_match_variables,
@@ -675,6 +677,17 @@ t_map_size(Config) when is_list(Config) ->
map_is_size(M,N) when map_size(M) =:= N -> true;
map_is_size(_,_) -> false.
+t_is_map(Config) when is_list(Config) ->
+ true = is_map(#{}),
+ true = is_map(#{a=>1}),
+ false = is_map({a,b}),
+ false = is_map(x),
+ if is_map(#{}) -> ok end,
+ if is_map(#{b=>1}) -> ok end,
+ if not is_map([1,2,3]) -> ok end,
+ if not is_map(x) -> ok end,
+ ok.
+
% test map updates without matching
t_update_literals(Config) when is_list(Config) ->
Map = #{x=>1,y=>2,z=>3,q=>4},