@@ -176,18 +176,17 @@ end
176
176
@test typeof (sum (Int8[])) == typeof (sum (Int8[1 ])) == typeof (sum (Int8[1 7 ]))
177
177
178
178
@testset " `sum` of empty collections with `init`" begin
179
+ function noncallable end # should not be called
179
180
@testset for init in [0 , 0.0 ]
180
181
@test sum ([]; init = init) === init
181
182
@test sum ((x for x in [123 ] if false ); init = init) === init
182
- @test sum (nothing , []; init = init) === init
183
- @test sum (nothing , (x for x in [123 ] if false ); init = init) === init
183
+ @test sum (noncallable , []; init = init) === init
184
+ @test sum (noncallable , (x for x in [123 ] if false ); init = init) === init
184
185
@test sum (Array {Any,3} (undef, 3 , 2 , 0 ); dims = 1 , init = init) == ₜ
185
186
zeros (typeof (init), 1 , 2 , 0 )
186
- @test sum (nothing , Array {Any,3} (undef, 3 , 2 , 0 ); dims = 1 , init = init) == ₜ
187
+ @test sum (noncallable , Array {Any,3} (undef, 3 , 2 , 0 ); dims = 1 , init = init) == ₜ
187
188
zeros (typeof (init), 1 , 2 , 0 )
188
189
end
189
- # Note: We are using `nothing` in place of the callable to make
190
- # sure that it's not actually called.
191
190
end
192
191
193
192
# check sum(abs, ...) for support of empty collections
@@ -218,18 +217,17 @@ end
218
217
@test typeof (prod (Array (trues (10 )))) == Bool
219
218
220
219
@testset " `prod` of empty collections with `init`" begin
220
+ function noncallable end # should not be called
221
221
@testset for init in [1 , 1.0 , " " ]
222
222
@test prod ([]; init = init) === init
223
223
@test prod ((x for x in [123 ] if false ); init = init) === init
224
- @test prod (nothing , []; init = init) === init
225
- @test prod (nothing , (x for x in [123 ] if false ); init = init) === init
224
+ @test prod (noncallable , []; init = init) === init
225
+ @test prod (noncallable , (x for x in [123 ] if false ); init = init) === init
226
226
@test prod (Array {Any,3} (undef, 3 , 2 , 0 ); dims = 1 , init = init) == ₜ
227
227
ones (typeof (init), 1 , 2 , 0 )
228
- @test prod (nothing , Array {Any,3} (undef, 3 , 2 , 0 ); dims = 1 , init = init) == ₜ
228
+ @test prod (noncallable , Array {Any,3} (undef, 3 , 2 , 0 ); dims = 1 , init = init) == ₜ
229
229
ones (typeof (init), 1 , 2 , 0 )
230
230
end
231
- # Note: We are using `nothing` in place of the callable to make
232
- # sure that it's not actually called.
233
231
end
234
232
235
233
# check type-stability
0 commit comments