diff options
author | Hans Bolinder <[email protected]> | 2019-04-17 13:20:56 +0200 |
---|---|---|
committer | Hans Bolinder <[email protected]> | 2019-05-07 08:25:03 +0200 |
commit | 77cbe3b6ced0ca42cf3ec5c8ca0333d9418a0372 (patch) | |
tree | 5e5e5f8785e10647ac62fb026134925ad64b053f /lib/dialyzer/test/indent_SUITE_data/src/sample_behaviour/sample_callback_correct.erl | |
parent | b0a7495c44ebf6741714948bdf5c0cb9593ec953 (diff) | |
download | otp-77cbe3b6ced0ca42cf3ec5c8ca0333d9418a0372.tar.gz otp-77cbe3b6ced0ca42cf3ec5c8ca0333d9418a0372.tar.bz2 otp-77cbe3b6ced0ca42cf3ec5c8ca0333d9418a0372.zip |
dialyzer: Add test cases with indentation
A smallish selection of already existing tests, run with
the indentation option.
Diffstat (limited to 'lib/dialyzer/test/indent_SUITE_data/src/sample_behaviour/sample_callback_correct.erl')
-rw-r--r-- | lib/dialyzer/test/indent_SUITE_data/src/sample_behaviour/sample_callback_correct.erl | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/dialyzer/test/indent_SUITE_data/src/sample_behaviour/sample_callback_correct.erl b/lib/dialyzer/test/indent_SUITE_data/src/sample_behaviour/sample_callback_correct.erl new file mode 100644 index 0000000000..ab0378e6f0 --- /dev/null +++ b/lib/dialyzer/test/indent_SUITE_data/src/sample_behaviour/sample_callback_correct.erl @@ -0,0 +1,32 @@ +-module(sample_callback_correct). + +-behaviour(sample_behaviour). + +-export([ + sample_callback_1/0, + sample_callback_2/0, + sample_callback_3/0, + sample_callback_4/1, + sample_callback_5/1, + sample_callback_6/3 + ]). + +sample_callback_1() -> 42. % This is a valid return. +sample_callback_2() -> foo. % This is a valid return. +sample_callback_3() -> {ok, 17}. % This is a valid return. +sample_callback_4(Input) -> + put(mine, Input+1), % This is valid handling of the input + ok. % This is a valid return. +sample_callback_5(Input) -> + case Input - 1 < 22 of % This is valid handling of the input + true -> ok; % This is a valid return. + false -> fail % This is a valid return. + end. +sample_callback_6(OldNr, NewNr, Reason) -> + Diff = NewNr - OldNr, % This is valid handling of the input + Msg = string:join(["Reason: ", Reason], ","), % This is valid handling of the input + case Diff > 0 of + true -> put(mine, {NewNr, Msg}), + {ok, NewNr}; % This is a valid return. + false -> fail % This is a valid return. + end. |