Skip to content

Commit

Permalink
Add tests to check for issue JuliaLang#37863.
Browse files Browse the repository at this point in the history
Add a new test to check whether `asyncmap` computes lazily-generated
sequences withinin a single task, as described by issue JuliaLang#37863.
  • Loading branch information
kernelmethod committed Oct 4, 2020
1 parent defde49 commit 0f5cf06
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/asyncmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,10 @@ generic_map_tests(asyncmap, asyncmap!)
run_map_equivalence_tests(asyncmap)
using Base.Unicode: uppercase
@test asyncmap(uppercase, "Hello World!") == map(uppercase, "Hello World!")

# issue #37863
# If asyncmap is run over a lazily-generated sequence, computation of
# each element of the sequence should be deferred to the task that
# applies the mapped function to it
seq = ((sleep(1.0); objectid(current_task())) for _ = 1:10)
@test allunique(asyncmap(identity, seq))

0 comments on commit 0f5cf06

Please sign in to comment.