Skip to content

Commit fd0fb71

Browse files
committed
add tests
1 parent 3d2fa57 commit fd0fb71

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

test/ir.jl

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using MLIR.Dialects: arith
1+
using MLIR.Dialects: arith, builtin
22
using MLIR.IR, LLVM
33

44
@testset "operation introspection" begin
@@ -11,3 +11,16 @@ using MLIR.IR, LLVM
1111
@test IR.get_attribute_by_name(op, "value") |> IR.bool_value
1212
end
1313
end
14+
15+
@testset "Module construction from operation" begin
16+
IR.context!(IR.Context()) do
17+
op = builtin.module_(bodyRegion=IR.Region())
18+
mod = IR.Module(op)
19+
op = IR.get_operation(mod)
20+
21+
@test IR.name(op) == "builtin.module"
22+
23+
# Only a `module` operation can be used to create a module.
24+
@test_throws AssertionError IR.Module(arith.constant(; value=true, result=MLIRType(Bool)))
25+
end
26+
end

0 commit comments

Comments
 (0)