Skip to content

Commit 7f58859

Browse files
committed
Add explicit cycle/1 test for {:halted, []} on first pass
1 parent 4559989 commit 7f58859

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lib/elixir/test/elixir/stream_test.exs

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

266+
assert_raise ArgumentError, "cannot cycle over an empty enumerable", fn ->
267+
Stream.cycle(%HaltAcc{acc: []}) |> Enum.to_list()
268+
end
269+
266270
assert Stream.cycle([1, 2, 3]) |> Stream.take(5) |> Enum.to_list() == [1, 2, 3, 1, 2]
267271
assert Enum.take(stream, 5) == [1, 2, 3, 1, 2]
268272
end

0 commit comments

Comments
 (0)