diff options
author | Björn-Egil Dahlberg <[email protected]> | 2014-03-24 18:21:44 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-03-24 18:25:54 +0100 |
commit | 6c3ea418e174303615207c91b58f8ea29629ba26 (patch) | |
tree | 7e0952ea91a6940b17d0ceabc376970e98f63808 /lib/compiler/test | |
parent | b7b09745fefe5760d7783b68653a1aa66b1385fd (diff) | |
download | otp-6c3ea418e174303615207c91b58f8ea29629ba26.tar.gz otp-6c3ea418e174303615207c91b58f8ea29629ba26.tar.bz2 otp-6c3ea418e174303615207c91b58f8ea29629ba26.zip |
compiler: Test deep map structure
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/map_SUITE.erl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl index fe6273b8ac..a889043f73 100644 --- a/lib/compiler/test/map_SUITE.erl +++ b/lib/compiler/test/map_SUITE.erl @@ -41,6 +41,7 @@ t_build_and_match_empty_val/1, t_build_and_match_val/1, t_build_and_match_nil/1, + t_build_and_match_structure/1, %% errors in 17.0-rc1 t_update_values/1, @@ -70,6 +71,7 @@ all() -> [ t_build_and_match_empty_val, t_build_and_match_val, t_build_and_match_nil, + t_build_and_match_structure, %% errors in 17.0-rc1 t_update_values, @@ -574,9 +576,21 @@ t_build_and_match_nil(Config) when is_list(Config) -> "treat" => V2, [] => V1 }), #{ [] := V3, [] := V3 } = id(#{ [] => V1, [] => V3 }), - ok. +t_build_and_match_structure(Config) when is_list(Config) -> + V2 = id("it"), + S = id([42,{"hi", "=)", #{ "a" => 42, any => any, val => "get_" ++ V2}}]), + + %% match deep map values + V2 = case S of + [42,{"hi",_, #{ "a" := 42, val := "get_" ++ V1, any := _ }}] -> V1 + end, + %% match deep map + ok = case S of + [42,{"hi",_, #{ }}] -> ok + end, + ok. %% Use this function to avoid compile-time evaluation of an expression. id(I) -> I. |