aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2014-01-28 14:46:16 +0100
committerBjörn-Egil Dahlberg <[email protected]>2014-01-29 11:08:51 +0100
commitcf5bc2e917dbcb2c2841bf07b995efe105bea4be (patch)
treed0e5931dab4a223c65721e33dde604def21d842d
parent54e921a5944394665acab44b210fdb677b4d15e9 (diff)
downloadotp-cf5bc2e917dbcb2c2841bf07b995efe105bea4be.tar.gz
otp-cf5bc2e917dbcb2c2841bf07b995efe105bea4be.tar.bz2
otp-cf5bc2e917dbcb2c2841bf07b995efe105bea4be.zip
compiler: Add core compile test for maps
-rw-r--r--lib/compiler/test/core_SUITE.erl8
-rw-r--r--lib/compiler/test/core_SUITE_data/map_core_test.core95
2 files changed, 101 insertions, 2 deletions
diff --git a/lib/compiler/test/core_SUITE.erl b/lib/compiler/test/core_SUITE.erl
index a40dc32d59..1a521c3591 100644
--- a/lib/compiler/test/core_SUITE.erl
+++ b/lib/compiler/test/core_SUITE.erl
@@ -23,7 +23,8 @@
init_per_testcase/2,end_per_testcase/2,
dehydrated_itracer/1,nested_tries/1,
seq_in_guard/1,make_effect_seq/1,eval_is_boolean/1,
- unsafe_case/1,nomatch_shadow/1,reversed_annos/1]).
+ unsafe_case/1,nomatch_shadow/1,reversed_annos/1,
+ map_core_test/1]).
-include_lib("test_server/include/test_server.hrl").
@@ -48,7 +49,9 @@ all() ->
groups() ->
[{p,test_lib:parallel(),
[dehydrated_itracer,nested_tries,seq_in_guard,make_effect_seq,
- eval_is_boolean,unsafe_case,nomatch_shadow,reversed_annos]}].
+ eval_is_boolean,unsafe_case,nomatch_shadow,reversed_annos,
+ map_core_test
+ ]}].
init_per_suite(Config) ->
@@ -72,6 +75,7 @@ end_per_group(_GroupName, Config) ->
?comp(unsafe_case).
?comp(nomatch_shadow).
?comp(reversed_annos).
+?comp(map_core_test).
try_it(Mod, Conf) ->
Src = filename:join(?config(data_dir, Conf), atom_to_list(Mod)),
diff --git a/lib/compiler/test/core_SUITE_data/map_core_test.core b/lib/compiler/test/core_SUITE_data/map_core_test.core
new file mode 100644
index 0000000000..7ece8a8bbd
--- /dev/null
+++ b/lib/compiler/test/core_SUITE_data/map_core_test.core
@@ -0,0 +1,95 @@
+module 'map_core_test' ['map_core_test'/0,
+ 'module_info'/0,
+ 'module_info'/1]
+ attributes []
+'map_core_test'/0 =
+ %% Line 14
+ fun () ->
+ let <_cor0> =
+ %% Line 15
+ ~{::<'check','ok'>,::<1337,#{#<104>(8,1,'integer',['unsigned'|['big']]),
+ #<101>(8,1,'integer',['unsigned'|['big']]),
+ #<108>(8,1,'integer',['unsigned'|['big']]),
+ #<108>(8,1,'integer',['unsigned'|['big']]),
+ #<111>(8,1,'integer',['unsigned'|['big']])}#>,::<'val',0>}~
+ in let <M> =
+ %% Line 15
+ apply 'id'/1
+ (_cor0)
+ in let <_cor2> =
+ %% Line 16
+ apply 'id'/1
+ ([1|[2|[3|[4|[5|[6]]]]]])
+ in %% Line 16
+ case apply 'call'/2
+ (M, _cor2) of
+ <~{~<1337,#{#<104>(8,1,'integer',['unsigned'|['big']]),
+ #<101>(8,1,'integer',['unsigned'|['big']]),
+ #<108>(8,1,'integer',['unsigned'|['big']]),
+ #<108>(8,1,'integer',['unsigned'|['big']]),
+ #<111>(8,1,'integer',['unsigned'|['big']]),
+ #<32>(8,1,'integer',['unsigned'|['big']]),
+ #<49>(8,1,'integer',['unsigned'|['big']]),
+ #<32>(8,1,'integer',['unsigned'|['big']]),
+ #<50>(8,1,'integer',['unsigned'|['big']]),
+ #<32>(8,1,'integer',['unsigned'|['big']]),
+ #<51>(8,1,'integer',['unsigned'|['big']]),
+ #<32>(8,1,'integer',['unsigned'|['big']]),
+ #<52>(8,1,'integer',['unsigned'|['big']]),
+ #<32>(8,1,'integer',['unsigned'|['big']]),
+ #<53>(8,1,'integer',['unsigned'|['big']]),
+ #<32>(8,1,'integer',['unsigned'|['big']]),
+ #<54>(8,1,'integer',['unsigned'|['big']])}#>,~<'check','ok'>,~<'val',21>}~> when 'true' ->
+ %% Line 17
+ 'ok'
+ ( <_cor3> when 'true' ->
+ primop 'match_fail'
+ ({'badmatch',_cor3})
+ -| ['compiler_generated'] )
+ end
+'call'/2 =
+ %% Line 20
+ fun (_cor1,_cor0) ->
+ case <_cor1,_cor0> of
+ <M = ~{~<1337,Bin>,~<'check',_cor8>,~<'val',Val>}~,[V|Vs]> when 'true' ->
+ let <_cor3> =
+ %% Line 21
+ call 'erlang':'+'
+ (V, 48)
+ in let <_cor4> =
+ %% Line 21
+ #{#<Bin>('all',8,'binary',['unsigned'|['big']]),
+ #<32>(8,1,'integer',['unsigned'|['big']]),
+ #<_cor3>(8,1,'integer',['unsigned'|['big']])}#
+ in let <_cor2> =
+ %% Line 21
+ call 'erlang':'+'
+ (Val, V)
+ in let <_cor5> =
+ %% Line 21
+ M~{~<1337,_cor4>,~<'val',_cor2>}~
+ in %% Line 21
+ apply 'call'/2
+ (_cor5, Vs)
+ %% Line 22
+ <M,[]> when 'true' ->
+ M
+ ( <_cor7,_cor6> when 'true' ->
+ ( primop 'match_fail'
+ ({'function_clause',_cor7,_cor6})
+ -| [{'function_name',{'call',2}}] )
+ -| ['compiler_generated'] )
+ end
+'id'/1 =
+ %% Line 24
+ fun (_cor0) ->
+ _cor0
+'module_info'/0 =
+ fun () ->
+ call 'erlang':'get_module_info'
+ ('map_core_test')
+'module_info'/1 =
+ fun (_cor0) ->
+ call 'erlang':'get_module_info'
+ ('map_core_test', _cor0)
+end \ No newline at end of file