@@ -186,6 +186,22 @@ Context() do ctx
186
186
@test context (typ) == ctx
187
187
end
188
188
189
+ # type iteration
190
+ Context () do ctx
191
+ st = LLVM. StructType (" SomeType" , ctx)
192
+
193
+ let ts = types (ctx)
194
+ @test keytype (ts) == String
195
+ @test valtype (ts) == LLVMType
196
+
197
+ @test haskey (ts, " SomeType" )
198
+ @test ts[" SomeType" ] == st
199
+
200
+ @test ! haskey (ts, " SomeOtherType" )
201
+ @test_throws KeyError ts[" SomeOtherType" ]
202
+ end
203
+ end
204
+
189
205
end
190
206
191
207
@@ -450,6 +466,8 @@ Context() do ctx
450
466
ConstantFP (LLVM. HalfType (ctx), - 2.5 )
451
467
]
452
468
@test collect (operands (constant_struct)) == expected_operands
469
+
470
+ @test_throws ArgumentError ConstantStruct (test_struct, ctx; anonymous= false )
453
471
end
454
472
455
473
end
@@ -652,26 +670,6 @@ LLVM.Module("SomeModule", ctx) do mod
652
670
end
653
671
end
654
672
655
- # type iteration
656
- Context () do ctx
657
- LLVM. Module (" SomeModule" , ctx) do mod
658
- st = LLVM. StructType (" SomeType" , ctx)
659
- ft = LLVM. FunctionType (st, [st])
660
- fn = LLVM. Function (mod, " SomeFunction" , ft)
661
-
662
- let ts = types (mod)
663
- @test keytype (ts) == String
664
- @test valtype (ts) == LLVMType
665
-
666
- @test haskey (ts, " SomeType" )
667
- @test ts[" SomeType" ] == st
668
-
669
- @test ! haskey (ts, " SomeOtherType" )
670
- @test_throws KeyError ts[" SomeOtherType" ]
671
- end
672
- end
673
- end
674
-
675
673
# metadata iteration
676
674
Context () do ctx
677
675
LLVM. Module (" SomeModule" , ctx) do mod
0 commit comments