Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Commit

Permalink
Add eltype tests for peekiter and remove dupe
Browse files Browse the repository at this point in the history
  • Loading branch information
iamed2 committed Oct 13, 2016
1 parent c3f0692 commit 73ab8e3
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -361,19 +361,16 @@ tn3 = takenth(10:20, 1)

# peekiter
# --------
result = Int[]
for x in peekiter(1:10) push!(result, x) end
@test result == collect(1:10)
pi0 = peekiter(1:10)
@test eltype(pi0) == Int
@test collect(pi0) == collect(1:10)

result = Int[]
for x in peekiter([]) push!(result, x) end
@test result == []

result = Int[]
for x in peekiter(1:10) push!(result, x) end
@test result == collect(1:10)
pi1 = peekiter([])
@test eltype(pi1) == eltype([])
@test collect(pi1) == collect([])

it = peekiter([:a, :b, :c])
@test eltype(it) == Symbol
s = start(it)
@test get(peek(it, s)) == :a

Expand Down

0 comments on commit 73ab8e3

Please sign in to comment.