aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/maps_SUITE.erl
diff options
context:
space:
mode:
authorLars Thorsen <[email protected]>2015-05-20 10:12:46 +0200
committerLars Thorsen <[email protected]>2015-05-20 10:12:46 +0200
commit7b81ed532898c735ad8901723df373e5f0246127 (patch)
tree5f69565b5016fb08d3bd62ecaf53fa12d4cb7c51 /lib/stdlib/test/maps_SUITE.erl
parentfd63f2b7108e2607e43d709e6d3885e4a7406ec8 (diff)
parent5bd9afcd35d1a5c46dce8e75c650841a3061f45b (diff)
downloadotp-7b81ed532898c735ad8901723df373e5f0246127.tar.gz
otp-7b81ed532898c735ad8901723df373e5f0246127.tar.bz2
otp-7b81ed532898c735ad8901723df373e5f0246127.zip
Merge branch 'master' of git-server:otp
Conflicts: lib/orber/src/orber.app.src
Diffstat (limited to 'lib/stdlib/test/maps_SUITE.erl')
-rw-r--r--lib/stdlib/test/maps_SUITE.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/stdlib/test/maps_SUITE.erl b/lib/stdlib/test/maps_SUITE.erl
index 1d9c041a74..21e146ae3d 100644
--- a/lib/stdlib/test/maps_SUITE.erl
+++ b/lib/stdlib/test/maps_SUITE.erl
@@ -34,7 +34,7 @@
-export([init_per_testcase/2]).
-export([end_per_testcase/2]).
--export([t_get_3/1,
+-export([t_get_3/1, t_filter_2/1,
t_fold_3/1,t_map_2/1,t_size_1/1,
t_with_2/1,t_without_2/1]).
@@ -45,7 +45,7 @@ suite() ->
[{ct_hooks, [ts_install_cth]}].
all() ->
- [t_get_3,
+ [t_get_3,t_filter_2,
t_fold_3,t_map_2,t_size_1,
t_with_2,t_without_2].
@@ -99,6 +99,16 @@ t_with_2(_Config) ->
?badarg(with,[a,#{}]) = (catch maps:with(a,#{})),
ok.
+t_filter_2(Config) when is_list(Config) ->
+ M = #{a => 2, b => 3, c=> 4, "a" => 1, "b" => 2, "c" => 4},
+ Pred1 = fun(K,V) -> is_atom(K) andalso (V rem 2) =:= 0 end,
+ Pred2 = fun(K,V) -> is_list(K) andalso (V rem 2) =:= 0 end,
+ #{a := 2,c := 4} = maps:filter(Pred1,M),
+ #{"b" := 2,"c" := 4} = maps:filter(Pred2,M),
+ %% error case
+ ?badmap(a,filter,[_,a]) = (catch maps:filter(fun(_,_) -> ok end,id(a))),
+ ?badarg(filter,[<<>>,#{}]) = (catch maps:filter(id(<<>>),#{})),
+ ok.
t_fold_3(Config) when is_list(Config) ->
Vs = lists:seq(1,200),