aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2015-05-07 11:57:49 +0200
committerBjörn-Egil Dahlberg <[email protected]>2015-05-07 11:57:49 +0200
commit36fe05d30ecb1bc7b8d4665bff38caf61c9ae0f8 (patch)
tree830c2bf1689074df7272fb548caa1cbd7eedbbbc
parent757d493cff18d0b52aeb1e32d01886551e16fd5d (diff)
downloadotp-36fe05d30ecb1bc7b8d4665bff38caf61c9ae0f8.tar.gz
otp-36fe05d30ecb1bc7b8d4665bff38caf61c9ae0f8.tar.bz2
otp-36fe05d30ecb1bc7b8d4665bff38caf61c9ae0f8.zip
stdlib: Strengthen ETS Maps tests
Ensure db_has_variable is tested for large Maps as well.
-rw-r--r--lib/stdlib/test/ets_SUITE.erl8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/stdlib/test/ets_SUITE.erl b/lib/stdlib/test/ets_SUITE.erl
index 27de83cdc9..41bd4af241 100644
--- a/lib/stdlib/test/ets_SUITE.erl
+++ b/lib/stdlib/test/ets_SUITE.erl
@@ -3896,7 +3896,15 @@ match_object_do(Opts) ->
[{#{1:="hi",2:="hi",59:="hi"},12},{#{1:=1,2:=2,39:=39,100:=100},11}] -> ok;
_ -> ?t:fail("ets:match_object() returned something funny.")
end,
+ case ets:match_object(Tab, {maps:from_list([{I,'_'}||I<-Is]),'_'}) of
+ %% only match a part of the map
+ [{#{1:=1,5:=5,99:=99,100:=100},11},{#{1:="hi",6:="hi",99:="hi"},12}] -> ok;
+ [{#{1:="hi",2:="hi",59:="hi"},12},{#{1:=1,2:=2,39:=39,100:=100},11}] -> ok;
+ _ -> ?t:fail("ets:match_object() returned something funny.")
+ end,
{'EXIT',{badarg,_}} = (catch ets:match_object(Tab, {#{'$1'=>'_'},7})),
+ Mve = maps:from_list([{list_to_atom([$$|integer_to_list(I)]),'_'}||I<-Is]),
+ {'EXIT',{badarg,_}} = (catch ets:match_object(Tab, {Mve,11})),
% Check that unsuccessful match returns an empty list.
[] = ets:match_object(Tab, {{three,'$0'}, '$92'}),