Skip to content

Commit 0a0fbbb

Browse files
committed
add C-compat test
1 parent f7269c5 commit 0a0fbbb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/runtests.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,14 @@ end
570570
@test inlinestrings(["a", "b", ""]) == [String1("a"), String1("b"), String1("")]
571571
@test String1("") == ""
572572

573+
@testset "C-compatibility" begin
574+
for S in SUBTYPES
575+
data = randstring(Core.sizeof(S) - 1)
576+
str = S(data)
577+
@test (@ccall strlen(str::Cstring)::Csize_t) == length(data)
578+
end
579+
end
580+
573581
# only test package extension on >= 1.9.0
574582
if VERSION >= v"1.9.0" && Sys.WORD_SIZE == 64
575583
include(joinpath(dirname(pathof(InlineStrings)), "../ext/tests.jl"))

0 commit comments

Comments
 (0)