Skip to content

Commit

Permalink
Merge pull request #57 from timholy/teh/julia41885
Browse files Browse the repository at this point in the history
Generalize exception type
  • Loading branch information
shashi authored Aug 19, 2021
2 parents 6e93825 + e4aef91 commit 9d533c9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ end
@test_throws ArgumentError reducevalues(+, maketree("." => []))
@test reducevalues(+, maketree("." => []), init=0) === 0

@test_throws ArgumentError reducevalues(+, maketree("." => []), associative=false)
@test_throws Union{ArgumentError,MethodError} reducevalues(+, maketree("." => []), associative=false)
@test reducevalues(+, maketree("." => []), init=0, associative=false) === 0

# issue 23
Expand Down Expand Up @@ -235,22 +235,22 @@ end
import Dagger

struct SpecialContext end

computespecial = Ref(false)
function Dagger.compute(::SpecialContext, t::Dagger.Thunk, kws...)
computespecial[] = true
compute(Dagger.Context(procs()), t; kws...)
end
ncollectspecial = Ref(0)
function Dagger.collect(::SpecialContext, c::Dagger.Chunk; kws...)
function Dagger.collect(::SpecialContext, c::Dagger.Chunk; kws...)
ncollectspecial[] += 1
collect(Dagger.Context(procs()), c; kws...)
end

t = mapvalues(identity, maketree("a" => ["b" => [(name="c", value=1)], "d" => ["e" => [(name="f", value=2), (name="g", value=3)]]]), lazy=true)
@test exec(SpecialContext(), t) |> values == [1,2,3]
@test computespecial[] == true # Dummy compare to make failed test outprint a little less confusing

@test exec(SpecialContext(), t) |> values == [1,2,3]
@test computespecial[] == true # Dummy compare to make failed test outprint a little less confusing
@test ncollectspecial[] == 3 # All values are collected with SpecialContext
end

Expand Down

0 comments on commit 9d533c9

Please sign in to comment.