Skip to content

Commit d344dc4

Browse files
committed
test: add a test for error
1 parent 350c483 commit d344dc4

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ PythonCall = "0.9"
9090
Random = "1.10"
9191
Random123 = "1.7"
9292
ReactantCore = "0.1.12"
93-
Reactant_jll = "0.0.198"
93+
Reactant_jll = "0.0.199"
9494
ScopedValues = "1.3.0"
9595
Scratch = "1.2"
9696
Sockets = "1.10"

test/callback.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Reactant
2+
3+
function fn(x)
4+
error("This should error at runtime")
5+
return x .+ 1
6+
end
7+
8+
@testset "error" begin
9+
x = Reactant.to_rarray(ones(4))
10+
11+
hlo = repr(@code_hlo fn(x))
12+
@test contains(hlo, "stablehlo.custom_call")
13+
14+
fn_compiled = @compile fn(x)
15+
@test_throws Reactant.XLA.ReactantInternalError fn_compiled(x)
16+
end

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const REACTANT_TEST_GROUP = lowercase(get(ENV, "REACTANT_TEST_GROUP", "all"))
3737
@safetestset "Cluster Detection" include("cluster_detector.jl")
3838
@safetestset "Config" include("config.jl")
3939
@safetestset "Batching" include("batching.jl")
40+
@safetestset "Callbacks" include("callback.jl")
4041
end
4142

4243
if REACTANT_TEST_GROUP == "all" || REACTANT_TEST_GROUP == "integration"

0 commit comments

Comments
 (0)