aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-11-08 14:40:34 +0100
committerGitHub <[email protected]>2018-11-08 14:40:34 +0100
commit00485ab085698545f2c95becad201199479bd535 (patch)
tree796e5605e60ab0961acb6f9c7ce94cd13c31c30e /lib/compiler/test
parent9f841760f5fd6c6fc9078e99e5b0f8199e820c19 (diff)
parent0c374a1de1a4b880fe2f7dba8ef4eefafc975af7 (diff)
downloadotp-00485ab085698545f2c95becad201199479bd535.tar.gz
otp-00485ab085698545f2c95becad201199479bd535.tar.bz2
otp-00485ab085698545f2c95becad201199479bd535.zip
Merge pull request #2013 from bjorng/bjorn/compiler/clean-up-beam_utils
Clean up the beam_utils module
Diffstat (limited to 'lib/compiler/test')
-rw-r--r--lib/compiler/test/bs_match_SUITE.erl12
-rw-r--r--lib/compiler/test/misc_SUITE.erl8
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl
index 0c6db96081..01f302ad21 100644
--- a/lib/compiler/test/bs_match_SUITE.erl
+++ b/lib/compiler/test/bs_match_SUITE.erl
@@ -742,6 +742,10 @@ coverage(Config) when is_list(Config) ->
binary = coverage_bitstring(<<7>>),
bitstring = coverage_bitstring(<<7:4>>),
other = coverage_bitstring([a]),
+
+ {done,<<17,53>>,[253,155,200]} =
+ coverage_trim(<<253,155,200,17,53>>, e0, e1, e2, e3, []),
+
ok.
coverage_fold(Fun, Acc, <<H,T/binary>>) ->
@@ -836,6 +840,14 @@ coverage_bitstring(Bin) when is_binary(Bin) -> binary;
coverage_bitstring(<<_/bitstring>>) -> bitstring;
coverage_bitstring(_) -> other.
+coverage_trim(<<C:8,T/binary>> = Bin, E0, E1, E2, E3, Acc) ->
+ case id(C > 128) of
+ true ->
+ coverage_trim(T, E0, E1, E2, E3, [C|Acc]);
+ false ->
+ {done,Bin,lists:reverse(Acc)}
+ end.
+
multiple_uses(Config) when is_list(Config) ->
{344,62879,345,<<245,159,1,89>>} = multiple_uses_1(<<1,88,245,159,1,89>>),
true = multiple_uses_2(<<0,0,197,18>>),
diff --git a/lib/compiler/test/misc_SUITE.erl b/lib/compiler/test/misc_SUITE.erl
index c9acda2b6d..d6fc51448f 100644
--- a/lib/compiler/test/misc_SUITE.erl
+++ b/lib/compiler/test/misc_SUITE.erl
@@ -234,6 +234,10 @@ silly_coverage(Config) when is_list(Config) ->
{label,2}|non_proper_list]}],99},
expect_error(fun() -> beam_except:module(ExceptInput, []) end),
+ %% beam_jump
+ JumpInput = BlockInput,
+ expect_error(fun() -> beam_jump:module(JumpInput, []) end),
+
%% beam_clean
CleanInput = {?MODULE,[{foo,0}],[],
[{function,foo,0,2,
@@ -243,6 +247,10 @@ silly_coverage(Config) when is_list(Config) ->
{jump,{f,42}}]}],99},
expect_error(fun() -> beam_clean:module(CleanInput, []) end),
+ %% beam_jump
+ TrimInput = BlockInput,
+ expect_error(fun() -> beam_trim:module(TrimInput, []) end),
+
%% beam_peep. This is tricky. Use a select instruction with
%% an odd number of elements in the list to crash
%% prune_redundant_values/2 but not beam_clean:clean_labels/1.