Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename internal Iterator::Slice type to not conflict with ::Slice #12983

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions spec/std/iterator_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ struct StructIter
end
end

private class MockIterator
include Iterator(Int32)

def initialize
@x = 0
@y = Slice(Int32).new(5)
end

def next
return stop if @x >= 3
@x += 1
end
end

describe Iterator do
describe "Iterator.of" do
it "creates singleton" do
Expand Down Expand Up @@ -527,6 +541,10 @@ describe Iterator do
iter.next.should eq([7, 8])
iter.next.should be_a(Iterator::Stop)
end

it "doesnt conflict with `::Slice` type" do
assert_iterates_iterator [1, 2, 3], MockIterator.new.each
end
Blacksmoke16 marked this conversation as resolved.
Show resolved Hide resolved
end

describe "step" do
Expand Down
Loading