Skip to content

Commit

Permalink
Test MissingInitError
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Dec 12, 2019
1 parent 5b51f18 commit c053d7e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test/preamble.jl
Expand Up @@ -5,7 +5,7 @@ using Statistics: mean
using Transducers
using Transducers: Transducer, simple_transduce, Reduced, isexpansive,
TeeZip, GetIndex, SetIndex, Inject, @~,
EmptyResultError, IdentityNotDefinedError, AbortIf, @next
EmptyResultError, IdentityNotDefinedError, MissingInitError, AbortIf, @next
using InitialValues: Init
using Logging: NullLogger, with_logger

Expand Down
4 changes: 4 additions & 0 deletions test/test_library.jl
Expand Up @@ -506,6 +506,10 @@ end
),
[1, 2, 1, 2, 3],
) == Dict(2 => 4, 1 => 2)

err = @test_error GroupBy(identity, -)
@test err isa MissingInitError
@test occursin("No default identity element for -", sprint(showerror, err))
end

@testset "ReduceIf" begin
Expand Down
6 changes: 6 additions & 0 deletions test/test_processes.jl
Expand Up @@ -275,6 +275,12 @@ end
@test occursin("op = $unknownadd", msg)
end

@testset "MissingInitError" begin
err = @test_error foldl(-, Map(identity), 1:1)
@test err isa MissingInitError
@test occursin("No default identity element for -", sprint(showerror, err))
end

@testset "identityof error" begin
@test_throws EmptyResultError mapfoldl(Map(identity), right, Any[])
err = @test_error mapfoldl(Map(identity), +, Any[])
Expand Down

0 comments on commit c053d7e

Please sign in to comment.