diff options
author | Björn Gustavsson <[email protected]> | 2017-12-13 15:54:50 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2017-12-13 15:54:50 +0100 |
commit | aef39d929f4ccbe159ba1a98a2a67a877c32c73b (patch) | |
tree | 1e5ae8552843d9da06a5b8661ffd920589090554 /lib | |
parent | 39e264fe45f931eaa6f62e2c2e9b5925f1201793 (diff) | |
download | otp-aef39d929f4ccbe159ba1a98a2a67a877c32c73b.tar.gz otp-aef39d929f4ccbe159ba1a98a2a67a877c32c73b.tar.bz2 otp-aef39d929f4ccbe159ba1a98a2a67a877c32c73b.zip |
map_SUITE: Cover beam_utils:bif_to_test/3
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compiler/test/map_SUITE.erl | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl index 5e90b79aa2..f15917e3cb 100644 --- a/lib/compiler/test/map_SUITE.erl +++ b/lib/compiler/test/map_SUITE.erl @@ -695,8 +695,28 @@ t_is_map(Config) when is_list(Config) -> if is_map(#{b=>1}) -> ok end, if not is_map([1,2,3]) -> ok end, if not is_map(x) -> ok end, + + ok = do_t_is_map(map, #{}), + error = do_t_is_map(map, {a,b,c}), + ok = do_t_is_map(number, 42), + ok = do_t_is_map(number, 42.0), + error = do_t_is_map(number, {a,b,c}), ok. +do_t_is_map(What, X) -> + B = case What of + map -> + %% Cover conversion of is_map/1 BIF to test instruction + %% in beam_utils:bif_to_test/3. + is_map(X); + number -> + is_number(X) + end, + case B of + true -> ok; + false -> error + end. + % test map updates without matching t_update_literals(Config) when is_list(Config) -> Map = #{x=>1,y=>2,z=>3,q=>4}, |