aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/erl_lint_SUITE.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-12-03 12:53:56 +0100
committerBjörn Gustavsson <[email protected]>2015-12-03 13:14:45 +0100
commitb7514ce549fc8865a2200c44fc686d46ed3d9291 (patch)
treef9a2c469c7a90be60627c5f8cafa78d162cafb89 /lib/stdlib/test/erl_lint_SUITE.erl
parent78b3b26ece408ca90e3e78873e9a0212777973fe (diff)
downloadotp-b7514ce549fc8865a2200c44fc686d46ed3d9291.tar.gz
otp-b7514ce549fc8865a2200c44fc686d46ed3d9291.tar.bz2
otp-b7514ce549fc8865a2200c44fc686d46ed3d9291.zip
Extend erl_lint:format_error/1 to handle bittype mismatches
erl_lint:format_error/1 would crash with a function error if conflicting types were given. That was most easily noticed in the shell: Eshell V7.0.3 (abort with ^G) 1> <<0/integer-binary>>. *** ERROR: Shell process terminated! *** Noticed-by: Aleksei Magusev
Diffstat (limited to 'lib/stdlib/test/erl_lint_SUITE.erl')
-rw-r--r--lib/stdlib/test/erl_lint_SUITE.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/stdlib/test/erl_lint_SUITE.erl b/lib/stdlib/test/erl_lint_SUITE.erl
index e6c1f4a87a..5347ccaf1f 100644
--- a/lib/stdlib/test/erl_lint_SUITE.erl
+++ b/lib/stdlib/test/erl_lint_SUITE.erl
@@ -3604,7 +3604,10 @@ bin_syntax_errors(Config) ->
t(<<X/unit:8>>) -> X;
t(<<X:7/float>>) -> X;
t(<< <<_:8>> >>) -> ok;
- t(<<(x ! y):8/integer>>) -> ok.
+ t(<<(x ! y):8/integer>>) -> ok;
+ t(X) ->
+ {<<X/binary-integer>>,<<X/signed-unsigned-integer>>,
+ <<X/little-big>>,<<X/unit:4-unit:8>>}.
">>,
[],
{error,[{1,erl_lint,illegal_bitsize},
@@ -3613,7 +3616,12 @@ bin_syntax_errors(Config) ->
{4,erl_lint,{undefined_bittype,bad_type}},
{5,erl_lint,bittype_unit},
{7,erl_lint,illegal_pattern},
- {8,erl_lint,illegal_pattern}],
+ {8,erl_lint,illegal_pattern},
+ {10,erl_lint,{bittype_mismatch,integer,binary,"type"}},
+ {10,erl_lint,{bittype_mismatch,unsigned,signed,"sign"}},
+ {11,erl_lint,{bittype_mismatch,8,4,"unit"}},
+ {11,erl_lint,{bittype_mismatch,big,little,"endianness"}}
+ ],
[{6,erl_lint,{bad_bitsize,"float"}}]}}
],
[] = run(Config, Ts),