Skip to content

Commit 8c3df68

Browse files
committed
Add test for cycling over empty enumberable
1 parent e12b377 commit 8c3df68

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/elixir/test/elixir/stream_test.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ defmodule StreamTest do
245245
Stream.cycle(%{}) |> Enum.to_list()
246246
end
247247

248+
assert_raise ArgumentError, "cannot cycle over an empty enumerable", fn ->
249+
Stream.cycle(..)
250+
end
251+
248252
assert Stream.cycle([1, 2, 3]) |> Stream.take(5) |> Enum.to_list() == [1, 2, 3, 1, 2]
249253
assert Enum.take(stream, 5) == [1, 2, 3, 1, 2]
250254
end

0 commit comments

Comments
 (0)