diff options
author | John Högberg <[email protected]> | 2018-11-07 15:34:07 +0100 |
---|---|---|
committer | John Högberg <[email protected]> | 2018-11-09 12:53:44 +0100 |
commit | 14cfdc2e8026dde8adeb43b6efb05122d7ff7c59 (patch) | |
tree | 2a8d3c2616f204154e04e708614c1fa660b01dc7 /lib/stdlib | |
parent | 506855722d1cb5cd7c81e608cce33526ff9d20e8 (diff) | |
download | otp-14cfdc2e8026dde8adeb43b6efb05122d7ff7c59.tar.gz otp-14cfdc2e8026dde8adeb43b6efb05122d7ff7c59.tar.bz2 otp-14cfdc2e8026dde8adeb43b6efb05122d7ff7c59.zip |
Make '++'/2 trapping
Diffstat (limited to 'lib/stdlib')
-rw-r--r-- | lib/stdlib/test/lists_SUITE.erl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/stdlib/test/lists_SUITE.erl b/lib/stdlib/test/lists_SUITE.erl index 17bb12e548..316b7a1ffa 100644 --- a/lib/stdlib/test/lists_SUITE.erl +++ b/lib/stdlib/test/lists_SUITE.erl @@ -158,6 +158,20 @@ append_2(Config) when is_list(Config) -> "abcdef"=lists:append("abc", "def"), [hej, du]=lists:append([hej], [du]), [10, [elem]]=lists:append([10], [[elem]]), + + %% Trapping, both crashing and otherwise. + [append_trapping_1(N) || N <- lists:seq(0, 20)], + + ok. + +append_trapping_1(N) -> + List = lists:duplicate(N + (1 bsl N), gurka), + ImproperList = List ++ crash, + + {'EXIT',_} = (catch (ImproperList ++ [])), + + [3, 2, 1 | List] = lists:reverse(List ++ [1, 2, 3]), + ok. %% Tests the lists:reverse() implementation. The function is |