[erl-frontend] Split up test methods into smaller units

Summary: If a test function `F` has multiple calls to a possibly problematic function `G`, our current expected output does not tell exactly which call to `G` causes the problem. This diff splits up such functions `F` into smaller parts `F1`, `F2`, ..., so that each part only calls `G` once. This way our expected output can match more precisely.

Reviewed By: rgrig

Differential Revision: D29554848

fbshipit-source-id: bdc62731c
master
Akos Hajdu 4 years ago committed by Facebook GitHub Bot
parent 566102d7f4
commit c4eddcb179

@ -1,13 +1,16 @@
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, assert_empty/1, 0, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [*** LATENT ***,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, assert_second_is_nil/1, 0, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [*** LATENT ***,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, fp_list_match_test_secondnil1_Ok/0, -17, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `assert_second_is_nil/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, fp_list_match_test_secondnil2_Ok/0, -20, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `assert_second_is_nil/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, fp_match_test_c_Ok/0, 1, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, fp_match_test_d_Ok/0, -31, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `tail/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, list_match_test_a/0, -4, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `tail/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, list_match_test_b/0, -8, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `assert_empty/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, list_match_test_c/0, -12, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `assert_second_is_nil/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, fp_match_test_d_Ok/0, -38, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `tail/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, list_match_test_empty2_Bad/0, -12, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `assert_empty/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, list_match_test_empty3_Bad/0, -14, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `assert_empty/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, list_match_test_secondnil3_Bad/0, -22, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `assert_second_is_nil/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, list_match_test_tail3_Bad/0, -8, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `tail/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, match_test_b_Bad/0, 1, CONSTANT_ADDRESS_DEREFERENCE, no_bucket, WARNING, [in call to `two/0`,is the constant 2,assigned,returned,return from call to `two/0`,invalid access occurs here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, match_test_b_Bad/0, 1, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, match_test_e_Bad/0, -35, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `tail/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, match_test_e_Bad/0, -42, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `tail/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, match_test_g_Bad/0, 7, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [calling context starts here,in call to `only_accepts_one/1`,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, only_accepts_one/1, 0, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [*** LATENT ***,no pattern match here]
codetoanalyze/erlang/nonmatch/src/nonmatch.erl, tail/1, 0, NONEXHAUSTIVE_PATTERN_MATCH, no_bucket, ERROR, [*** LATENT ***,no pattern match here]

@ -6,9 +6,15 @@
-module(nonmatch).
-export([
list_match_test_a/0,
list_match_test_b/0,
list_match_test_c/0,
list_match_test_tail1_Ok/0,
list_match_test_tail2_Ok/0,
list_match_test_tail3_Bad/0,
list_match_test_empty1_Ok/0,
list_match_test_empty2_Bad/0,
list_match_test_empty3_Bad/0,
fp_list_match_test_secondnil1_Ok/0,
fp_list_match_test_secondnil2_Ok/0,
list_match_test_secondnil3_Bad/0,
match_test_a_Ok/0,
match_test_b_Bad/0,
fp_match_test_c_Ok/0,
@ -22,20 +28,27 @@ tail([_ | Xs]) -> Xs.
assert_empty([]) -> ok.
assert_second_is_nil([_, [] | _]) -> ok.
list_match_test_a() ->
tail([1, 2]),
tail([1]),
list_match_test_tail1_Ok() ->
tail([1, 2]).
list_match_test_tail2_Ok() ->
tail([1]).
list_match_test_tail3_Bad() ->
tail([]).
list_match_test_b() ->
assert_empty([]),
assert_empty([1]),
list_match_test_empty1_Ok() ->
assert_empty([]).
list_match_test_empty2_Bad() ->
assert_empty([1]).
list_match_test_empty3_Bad() ->
assert_empty([1, 2]).
list_match_test_c() ->
% FP (T94492137)
assert_second_is_nil([1, [], 2]),
assert_second_is_nil([1, []]),
% FP (T94492137)
fp_list_match_test_secondnil1_Ok() ->
assert_second_is_nil([1, [], 2]).
% FP (T94492137)
fp_list_match_test_secondnil2_Ok() ->
assert_second_is_nil([1, []]).
list_match_test_secondnil3_Bad() ->
assert_second_is_nil([1, [2], 3]).
match_test_a_Ok() ->

Loading…
Cancel
Save