From e5c270a115558613ddd58802bca7d480410c1916 Mon Sep 17 00:00:00 2001 From: Pablo Zubieta Date: Sat, 31 Dec 2016 12:51:29 -0600 Subject: [PATCH] Test that broadcast doesn't propagate too much --- test/broadcast.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/broadcast.jl b/test/broadcast.jl index 6292a0065e21d..42ca5b935fa93 100644 --- a/test/broadcast.jl +++ b/test/broadcast.jl @@ -409,3 +409,12 @@ Base.Broadcast.broadcast_c(f, ::Type{Array19745}, A, Bs...) = @test isa(aa .+ 1, Array19745) @test isa(aa .* aa', Array19745) end + +# broadcast should only "peel off" one container layer +let io = IOBuffer() + broadcast(x -> print(io, x), [Nullable(1.0)]) + @test String(take!(io)) == "Nullable{Float64}(1.0)" + v = [] + broadcast(x -> push!(v, x), [Nullable(1)]) + @test get.(v) == get.([Nullable(1)]) +end