summaryrefslogtreecommitdiff
path: root/lib/elixir/test/elixir/stream_test.exs
diff options
context:
space:
mode:
authorMathias Klippinge <klippx@users.noreply.github.com>2016-05-27 21:23:15 +0200
committerJosé Valim <jose.valim@gmail.com>2016-05-27 21:23:15 +0200
commit0e3cbc78a002376ad137d54e15d8f6c4ce0c8d2b (patch)
treef365ec6971068c08fbdbd75df86b3a69722c0c4d /lib/elixir/test/elixir/stream_test.exs
parentc839521d741764fb8b516f24cbdeea1b262a4cd5 (diff)
downloadelixir-0e3cbc78a002376ad137d54e15d8f6c4ce0c8d2b.tar.gz
Add some extra tests for take_every and drop_every (#4702)
Also, now testing the correct function in the negative test.
Diffstat (limited to 'lib/elixir/test/elixir/stream_test.exs')
-rw-r--r--lib/elixir/test/elixir/stream_test.exs10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/elixir/test/elixir/stream_test.exs b/lib/elixir/test/elixir/stream_test.exs
index 262dec146..df4f2442a 100644
--- a/lib/elixir/test/elixir/stream_test.exs
+++ b/lib/elixir/test/elixir/stream_test.exs
@@ -225,6 +225,10 @@ defmodule StreamTest do
|> Enum.to_list == [2, 4, 6, 8, 10]
assert 1..10
+ |> Stream.drop_every(3)
+ |> Enum.to_list == [2, 3, 5, 6, 8, 9]
+
+ assert 1..10
|> Stream.drop(2)
|> Stream.drop_every(2)
|> Stream.drop(1)
@@ -245,7 +249,7 @@ defmodule StreamTest do
end
assert_raise FunctionClauseError, fn ->
- Stream.take_every(1..10, 3.33)
+ Stream.drop_every(1..10, 3.33)
end
end
@@ -790,6 +794,10 @@ defmodule StreamTest do
|> Enum.to_list == [1, 3, 5, 7, 9]
assert 1..10
+ |> Stream.take_every(3)
+ |> Enum.to_list == [1, 4, 7, 10]
+
+ assert 1..10
|> Stream.drop(2)
|> Stream.take_every(2)
|> Stream.drop(1)