Skip to content

Commit 46509e8

Browse files
committed
a few more tests
1 parent dce0526 commit 46509e8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/runtests.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,3 +209,28 @@ end
209209

210210
@test h(1, c=2) == 2
211211
end
212+
213+
struct Baz{T}
214+
w::T
215+
end
216+
217+
@testset "kwdispatch extra arg" begin
218+
global Baz
219+
220+
@kwdispatch (::Type{B})() where {B<:Baz} begin
221+
() -> B(0)
222+
(w) -> B(w)
223+
(z) -> B(sqrt(z))
224+
end
225+
226+
@test Baz() == Baz{Int}(0)
227+
@test Baz{Float64}() == Baz{Float64}(0.0)
228+
229+
@test Baz(w=3) == Baz{Int}(3)
230+
@test Baz(w=3.0) == Baz{Float64}(3.0)
231+
@test Baz{Float64}(w=3) == Baz{Float64}(3.0)
232+
233+
@test Baz(z=4) == Baz{Float64}(2.0)
234+
@test Baz{Int}(z=4) == Baz{Int}(2)
235+
@test Baz{Float64}(z=4) == Baz{Float64}(2.0)
236+
end

0 commit comments

Comments
 (0)