69
69
A = rand (4 , 4 )
70
70
@test fetch (@spawn sum (A; dims= 1 )) ≈ sum (A; dims= 1 )
71
71
72
- @test_throws_unwrap Dagger . DTaskFailedException fetch (@spawn sum (A; fakearg= 2 ))
72
+ @test_throws_unwrap MethodError fetch (@spawn sum (A; fakearg= 2 ))
73
73
74
74
@test fetch (@spawn reduce (+ , A; dims= 1 , init= 2.0 )) ≈
75
75
reduce (+ , A; dims= 1 , init= 2.0 )
194
194
a = @spawn error (" Test" )
195
195
wait (a)
196
196
@test isready (a)
197
- @test_throws_unwrap Dagger . DTaskFailedException fetch (a)
197
+ @test_throws_unwrap ErrorException fetch (a)
198
198
b = @spawn 1 + 2
199
199
@test fetch (b) == 3
200
200
end
207
207
catch err
208
208
err
209
209
end
210
- ex = Dagger. Sch. unwrap_nested_exception (ex)
211
210
ex_str = sprint (io-> Base. showerror (io,ex))
212
211
@test occursin (r" ^DTaskFailedException:" , ex_str)
213
212
@test occursin (" Test" , ex_str)
@@ -218,44 +217,43 @@ end
218
217
catch err
219
218
err
220
219
end
221
- ex = Dagger. Sch. unwrap_nested_exception (ex)
222
220
ex_str = sprint (io-> Base. showerror (io,ex))
223
221
@test occursin (" Test" , ex_str)
224
222
@test occursin (" Root Task" , ex_str)
225
223
end
226
224
@testset " single dependent" begin
227
225
a = @spawn error (" Test" )
228
226
b = @spawn a+ 2
229
- @test_throws_unwrap Dagger . DTaskFailedException fetch (a)
227
+ @test_throws_unwrap ErrorException fetch (a)
230
228
end
231
229
@testset " multi dependent" begin
232
230
a = @spawn error (" Test" )
233
231
b = @spawn a+ 2
234
232
c = @spawn a* 2
235
- @test_throws_unwrap Dagger . DTaskFailedException fetch (b)
236
- @test_throws_unwrap Dagger . DTaskFailedException fetch (c)
233
+ @test_throws_unwrap ErrorException fetch (b)
234
+ @test_throws_unwrap ErrorException fetch (c)
237
235
end
238
236
@testset " dependent chain" begin
239
237
a = @spawn error (" Test" )
240
- @test_throws_unwrap Dagger . DTaskFailedException fetch (a)
238
+ @test_throws_unwrap ErrorException fetch (a)
241
239
b = @spawn a+ 1
242
- @test_throws_unwrap Dagger . DTaskFailedException fetch (b)
240
+ @test_throws_unwrap ErrorException fetch (b)
243
241
c = @spawn b+ 2
244
- @test_throws_unwrap Dagger . DTaskFailedException fetch (c)
242
+ @test_throws_unwrap ErrorException fetch (c)
245
243
end
246
244
@testset " single input" begin
247
245
a = @spawn 1 + 1
248
246
b = @spawn (a-> error (" Test" ))(a)
249
247
@test fetch (a) == 2
250
- @test_throws_unwrap Dagger . DTaskFailedException fetch (b)
248
+ @test_throws_unwrap ErrorException fetch (b)
251
249
end
252
250
@testset " multi input" begin
253
251
a = @spawn 1 + 1
254
252
b = @spawn 2 * 2
255
253
c = @spawn ((a,b)-> error (" Test" ))(a,b)
256
254
@test fetch (a) == 2
257
255
@test fetch (b) == 4
258
- @test_throws_unwrap Dagger . DTaskFailedException fetch (c)
256
+ @test_throws_unwrap ErrorException fetch (c)
259
257
end
260
258
@testset " diamond" begin
261
259
a = @spawn 1 + 1
265
263
@test fetch (a) == 2
266
264
@test fetch (b) == 3
267
265
@test fetch (c) == 4
268
- @test_throws_unwrap Dagger . DTaskFailedException fetch (d)
266
+ @test_throws_unwrap ErrorException fetch (d)
269
267
end
270
268
end
269
+
271
270
@testset " remote spawn" begin
272
271
a = fetch (Distributed. @spawnat 2 Dagger. @spawn 1 + 2 )
273
272
@test Dagger. Sch. EAGER_INIT[]
283
282
t1 = Dagger. @spawn 1 + " fail"
284
283
Dagger. @spawn t1+ 1
285
284
end
286
- @test_throws_unwrap Dagger . DTaskFailedException fetch (t2)
285
+ @test_throws_unwrap MethodError fetch (t2)
287
286
end
288
287
@testset " undefined function" begin
289
288
# Issues #254, #255
0 commit comments