Skip to content

Commit

Permalink
Test show on dialect (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy authored Jan 21, 2024
1 parent 054a214 commit 3a43434
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/MLIR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ function Base.unsafe_convert(::Type{API.MlirStringRef}, s::Union{Symbol, String,
return API.MlirStringRef(p, sizeof(s))
end

function Base.String(str::API.MlirStringRef)
Base.unsafe_string(pointer(str.data), str.length)
end

module IR
import ..API: API

Expand Down
7 changes: 7 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ include("executionengine.jl")

@test s == reconstructed
end

@testset "show" begin
MLIR.IR.context!(MLIR.IR.Context()) do
dialect = MLIR.IR.get_or_load_dialect!("llvm")
@test sprint(show, dialect) == "Dialect(\"llvm\")"
end
end

0 comments on commit 3a43434

Please sign in to comment.