diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2014-06-27 14:47:26 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2014-08-20 12:30:13 +0200 |
commit | a46f30f38f0e757e9aa335e1452879db608d8489 (patch) | |
tree | a1c7fb2a0b9f0d7887f806f1090d3a91fd06ed03 /erts/emulator/test | |
parent | 764b0412344bf64f8b02ce198c41f14675b493a7 (diff) | |
download | otp-a46f30f38f0e757e9aa335e1452879db608d8489.tar.gz otp-a46f30f38f0e757e9aa335e1452879db608d8489.tar.bz2 otp-a46f30f38f0e757e9aa335e1452879db608d8489.zip |
Properly support maps in match_specs
Diffstat (limited to 'erts/emulator/test')
-rw-r--r-- | erts/emulator/test/match_spec_SUITE.erl | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/erts/emulator/test/match_spec_SUITE.erl b/erts/emulator/test/match_spec_SUITE.erl index fdce157abc..fc4a5028e1 100644 --- a/erts/emulator/test/match_spec_SUITE.erl +++ b/erts/emulator/test/match_spec_SUITE.erl @@ -30,6 +30,7 @@ -export([fpe/1]). -export([otp_9422/1]). -export([faulty_seq_trace/1, do_faulty_seq_trace/0]). +-export([maps/1]). -export([runner/2, loop_runner/3]). -export([f1/1, f2/2, f3/2, fn/1, fn/2, fn/3]). -export([do_boxed_and_small/0]). @@ -62,7 +63,8 @@ all() -> moving_labels, faulty_seq_trace, empty_list, - otp_9422]; + otp_9422, + maps]; true -> [not_run] end. @@ -899,6 +901,31 @@ fpe(Config) when is_list(Config) -> _ -> ok end. +maps(Config) when is_list(Config) -> + {ok,#{},[],[]} = erlang:match_spec_test(#{}, [{'_',[],['$_']}], table), + {ok,#{},[],[]} = erlang:match_spec_test(#{}, [{#{},[],['$_']}], table), + {ok,false,[],[]} = + erlang:match_spec_test(#{}, [{not_a_map,[],['$_']}], table), + {ok,bar,[],[]} = + erlang:match_spec_test(#{foo => bar}, + [{#{foo => '$1'},[],['$1']}], + table), + {ok,false,[],[]} = + erlang:match_spec_test(#{foo => bar}, + [{#{foo => qux},[],[qux]}], + table), + {ok,false,[],[]} = + erlang:match_spec_test(#{}, [{#{foo => '_'},[],[foo]}], table), + {error,_} = + erlang:match_spec_test(#{}, [{#{'$1' => '_'},[],[foo]}], table), + {ok,bar,[],[]} = + erlang:match_spec_test({#{foo => bar}}, + [{{#{foo => '$1'}},[],['$1']}], + table), + {ok,#{foo := 3},[],[]} = + erlang:match_spec_test({}, [{{},[],[#{foo => {'+',1,2}}]}], table), + ok. + empty_list(Config) when is_list(Config) -> Val=[{'$1',[], [{message,'$1'},{message,{caller}},{return_trace}]}], %% Did crash debug VM in faulty assert: |