diff options
author | Björn Gustavsson <[email protected]> | 2018-03-22 14:15:15 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2018-03-22 14:15:15 +0100 |
commit | 9773b04516f58dea50b0219fdf1eb9802d91c5d8 (patch) | |
tree | d3fe0c801f951bfa0cc16eabf47990b932d1ea19 /lib/compiler/test | |
parent | 63fa8a25427a3e8e5460568582475b0dbe804583 (diff) | |
parent | eb5892eec6480a89e574e0d7bdd9126844f32108 (diff) | |
download | otp-9773b04516f58dea50b0219fdf1eb9802d91c5d8.tar.gz otp-9773b04516f58dea50b0219fdf1eb9802d91c5d8.tar.bz2 otp-9773b04516f58dea50b0219fdf1eb9802d91c5d8.zip |
Merge pull request #1755 from bjorng/bjorn/compiler/lc/ERL-572/OTP-14992
Point out the correct line in an exception for a bad generator
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/lc_SUITE.erl | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/compiler/test/lc_SUITE.erl b/lib/compiler/test/lc_SUITE.erl index 9ad417b09b..699081470d 100644 --- a/lib/compiler/test/lc_SUITE.erl +++ b/lib/compiler/test/lc_SUITE.erl @@ -107,6 +107,31 @@ basic(Config) when is_list(Config) -> [] = [X || X <- L1, X+1 < 2], {'EXIT',_} = (catch [X || X <- L1, odd(X)]), fc([x], catch [E || E <- id(x)]), + + %% Make sure that line numbers point out the generator. + case ?MODULE of + lc_inline_SUITE -> + ok; + _ -> + {'EXIT',{function_clause, + [{?MODULE,_,_, + [{file,"bad_lc.erl"},{line,4}]}|_]}} = + (catch bad_generator(a)), + {'EXIT',{function_clause, + [{?MODULE,_,_, + [{file,"bad_lc.erl"},{line,4}]}|_]}} = + (catch bad_generator([a|b])), + {'EXIT',{badarg, + [{erlang,length,_,_}, + {?MODULE,bad_generator_bc,1, + [{file,"bad_lc.erl"},{line,7}]}|_]}} = + (catch bad_generator_bc(a)), + {'EXIT',{badarg, + [{erlang,length,_,_}, + {?MODULE,bad_generator_bc,1, + [{file,"bad_lc.erl"},{line,7}]}|_]}} = + (catch bad_generator_bc([a|b])) + end, ok. tuple_list() -> @@ -249,3 +274,11 @@ fc(Args, {'EXIT',{function_clause,[{?MODULE,_,Arity,_}|_]}}) fc(Args, {'EXIT',{{case_clause,ActualArgs},_}}) when ?MODULE =:= lc_inline_SUITE -> Args = tuple_to_list(ActualArgs). + +-file("bad_lc.erl", 1). +bad_generator(List) -> %Line 2 + [I || %Line 3 + I <- List]. %Line 4 +bad_generator_bc(List) -> %Line 5 + << <<I:4>> || %Line 6 + I <- List>>. %Line 7 |