aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-09-08 13:46:56 +0200
committerBjörn Gustavsson <[email protected]>2015-09-11 12:24:37 +0200
commit6b39473811ed8b10f6ee08f2871b971e702317bd (patch)
tree4528f0ea2105408cab790385eeccb42322c02fa1 /lib/stdlib/test
parent2ae8ec4507c090d51df41e21f7ad7786de040aad (diff)
downloadotp-6b39473811ed8b10f6ee08f2871b971e702317bd.tar.gz
otp-6b39473811ed8b10f6ee08f2871b971e702317bd.tar.bz2
otp-6b39473811ed8b10f6ee08f2871b971e702317bd.zip
lists_SUITE: Add a test case for lists:prefix/2
Diffstat (limited to 'lib/stdlib/test')
-rw-r--r--lib/stdlib/test/lists_SUITE.erl17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/stdlib/test/lists_SUITE.erl b/lib/stdlib/test/lists_SUITE.erl
index a0f7fd2744..175eb29af9 100644
--- a/lib/stdlib/test/lists_SUITE.erl
+++ b/lib/stdlib/test/lists_SUITE.erl
@@ -62,7 +62,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, droplast/1, hof/1]).
+ prefix/1, suffix/1, subtract/1, droplast/1, hof/1]).
%% Sort randomized lists until stopped.
%%
@@ -123,7 +123,7 @@ groups() ->
{tickets, [parallel], [otp_5939, otp_6023, otp_6606, otp_7230]},
{zip, [parallel], [zip_unzip, zip_unzip3, zipwith, zipwith3]},
{misc, [parallel], [reverse, member, dropwhile, takewhile,
- filter_partition, suffix, subtract,
+ filter_partition, prefix, suffix, subtract,
hof]}
].
@@ -2629,6 +2629,19 @@ otp_6606(Config) when is_list(Config) ->
?line L2 = lists:sort(L2),
ok.
+%% Test lists:prefix/2.
+prefix(Config) when is_list(Config) ->
+ true = lists:prefix([], []),
+ true = lists:prefix([], lists:seq(1, 10)),
+ true = lists:prefix([a], [a,b]),
+ true = lists:prefix(lists:seq(1, 10), lists:seq(1, 100)),
+
+ false = lists:prefix([a], []),
+ false = lists:prefix([a], [b]),
+ false = lists:prefix([a], [b,a]),
+
+ ok.
+
%% Test lists:suffix/2.
suffix(Config) when is_list(Config) ->
?line true = lists:suffix([], []),