Skip to content

Commit

Permalink
add C-compat test
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Jul 23, 2024
1 parent f7269c5 commit 0a0fbbb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,14 @@ end
@test inlinestrings(["a", "b", ""]) == [String1("a"), String1("b"), String1("")]
@test String1("") == ""

@testset "C-compatibility" begin
for S in SUBTYPES
data = randstring(Core.sizeof(S) - 1)
str = S(data)
@test (@ccall strlen(str::Cstring)::Csize_t) == length(data)
end
end

# only test package extension on >= 1.9.0
if VERSION >= v"1.9.0" && Sys.WORD_SIZE == 64
include(joinpath(dirname(pathof(InlineStrings)), "../ext/tests.jl"))
Expand Down

0 comments on commit 0a0fbbb

Please sign in to comment.