aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test/lists_SUITE.erl
diff options
context:
space:
mode:
authorHenrik Nord <[email protected]>2014-02-07 11:42:50 +0100
committerHenrik Nord <[email protected]>2014-02-07 11:42:50 +0100
commit069b1840316979c69e4bfed1c814a239b852d8ba (patch)
treeeaea7e45e5ab265f1f85d7ff63f69e2c482f0009 /lib/stdlib/test/lists_SUITE.erl
parent76181f2e146dea3638e70a8636690ab8b4397c70 (diff)
parent875b58c8119858676af0139b0f6b69537cae5706 (diff)
downloadotp-069b1840316979c69e4bfed1c814a239b852d8ba.tar.gz
otp-069b1840316979c69e4bfed1c814a239b852d8ba.tar.bz2
otp-069b1840316979c69e4bfed1c814a239b852d8ba.zip
Merge branch 'hsv/add_droplast_to_lists'
* hsv/add_droplast_to_lists: Added documentation of lists:droplast/1 Added tests for lists:droplast/1 to stdlib/lists_SUITE stdlib/lists: Add function droplast/1 This functions drops the last element of a non-empty list.
Diffstat (limited to 'lib/stdlib/test/lists_SUITE.erl')
-rw-r--r--lib/stdlib/test/lists_SUITE.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/stdlib/test/lists_SUITE.erl b/lib/stdlib/test/lists_SUITE.erl
index 92253ef5b9..f4589a8e24 100644
--- a/lib/stdlib/test/lists_SUITE.erl
+++ b/lib/stdlib/test/lists_SUITE.erl
@@ -61,7 +61,7 @@
zip_unzip/1, zip_unzip3/1, zipwith/1, zipwith3/1,
filter_partition/1,
otp_5939/1, otp_6023/1, otp_6606/1, otp_7230/1,
- suffix/1, subtract/1]).
+ suffix/1, subtract/1, droplast/1]).
%% Sort randomized lists until stopped.
%%
@@ -2641,4 +2641,12 @@ sub_non_matching(A, B) ->
sub(A, B) ->
Res = A -- B,
Res = lists:subtract(A, B).
-
+
+%% Test lists:droplast/1
+droplast(Config) when is_list(Config) ->
+ ?line [] = lists:droplast([x]),
+ ?line [x] = lists:droplast([x, y]),
+ ?line {'EXIT', {function_clause, _}} = (catch lists:droplast([])),
+ ?line {'EXIT', {function_clause, _}} = (catch lists:droplast(x)),
+
+ ok.