Skip to content

Commit

Permalink
Support tuple as default
Browse files Browse the repository at this point in the history
  • Loading branch information
omus committed Apr 14, 2018
1 parent df0e434 commit 8177d3b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bindings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function ingest_default!(b::Bindings, expr::Expr)
ingest_default!(b, arg)
end

elseif expr.head == :... || expr.head == :vect
elseif expr.head == :... || expr.head == :vect || expr.head == :tuple
for arg in expr.args
ingest_default!(b, arg)
end
Expand Down
5 changes: 5 additions & 0 deletions test/bindings/ingest_default.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ import Mocking: Bindings, ingest_default!
ingest_default!(b, :(f([Base.Bool])))
@test b.internal == Set()
@test b.external == Set([:f, :(Base.Bool)])

b = Bindings()
ingest_default!(b, :(f((Base.Bool,))))
@test b.internal == Set()
@test b.external == Set([:f, :(Base.Bool)])
end
6 changes: 6 additions & 0 deletions test/patch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ end
@test p.signature == :(f(a=[]))
@test p.modules == Set()
end

@testset "tuple default" begin
p = @patch f(a=()) = a
@test p.signature == :(f(a=()))
@test p.modules == Set()
end
end

0 comments on commit 8177d3b

Please sign in to comment.