Skip to content

Commit f5e9531

Browse files
authored
Update util.jl
1 parent ed1360f commit f5e9531

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

test/util.jl

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1-
function recursively_unwrap_task_failed_ex(ex::ErrorException)
2-
return ex
1+
extract_test_result_value(test_result::Test.Pass) = test_result.value
2+
3+
recursively_unwrap_ex(ex::ErrorException) = ex
4+
recursively_unwrap_ex(ex::Base.IOError) = ex
5+
function recursively_unwrap_ex(outer_ex::TaskFailedException)
6+
new_thing = outer_ex.task.exception
7+
return recursively_unwrap_ex(new_thing)
8+
end
9+
10+
Base.@kwdef struct ConfigForTestingTaskFailedException
11+
expected_outer_ex_T
12+
expected_inner_ex_T
13+
expected_inner_ex_INSTANCE
314
end
415

5-
function recursively_unwrap_task_failed_ex(outer_ex::TaskFailedException)
6-
return recursively_unwrap_task_failed_ex(outer_ex.task.exception)
16+
function test_task_failed_exception(test_result::Test.Pass, cfg::ConfigForTestingTaskFailedException)
17+
observed_outer_ex = extract_test_result_value(test_result)
18+
@test observed_outer_ex isa expected_outer_ex_T
19+
observed_inner_ex = recursively_unwrap_task_failed_ex(observed_outer_ex)
20+
@test observed_inner_ex isa typeof(expected_inner_ex_INSTANCE)
21+
@test observed_inner_ex == expected_inner_ex_INSTANCE
22+
return nothing
723
end
24+
25+
26+
27+
@test observed_inner_ex isa expected_inner_ex_T # TODO

0 commit comments

Comments
 (0)