aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
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 /erts/emulator
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 'erts/emulator')
-rw-r--r--erts/emulator/test/map_SUITE.erl14
1 files changed, 13 insertions, 1 deletions
diff --git a/erts/emulator/test/map_SUITE.erl b/erts/emulator/test/map_SUITE.erl
index ad8411cd68..490dd0c1ad 100644
--- a/erts/emulator/test/map_SUITE.erl
+++ b/erts/emulator/test/map_SUITE.erl
@@ -38,6 +38,7 @@
t_map_equal/1,
t_map_compare/1,
t_map_size/1,
+ t_is_map/1,
%% Specific Map BIFs
t_bif_map_get/1,
@@ -114,7 +115,7 @@ all() -> [
%% erlang
t_erlang_hash, t_map_encode_decode,
- t_map_size,
+ t_map_size, t_is_map,
%% non specific BIF related
t_bif_build_and_check,
@@ -680,6 +681,17 @@ build_and_check_size([],N,M) ->
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_large(Config) when is_list(Config) ->
Map = id(#{ 10=>id(a0),20=>b0,30=>id("c0"),"40"=>"d0",<<"50">>=>id("e0"),{["00"]}=>"10",