Skip to content

Test more UTF-8 characters in transcode #55580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions test/strings/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1392,8 +1392,15 @@ end
end

@testset "transcode" begin
str = "αβγ"
@test transcode(String, transcode(UInt16, str)) == str
@test transcode(String, transcode(UInt16, transcode(UInt8, str))) == str
@test transcode(String, transcode(UInt8, transcode(UInt16, str))) == str
# string starting with an ASCII character
str_1 = "zβγ"
# string starting with a 2 byte UTF-8 character
str_2 = "αβγ"
# string starting with a 3 byte UTF-8 character
str_3 = "आख"
@testset for str in (str_1, str_2, str_3)
@test transcode(String, transcode(UInt16, str)) == str
@test transcode(String, transcode(UInt16, transcode(UInt8, str))) == str
@test transcode(String, transcode(UInt8, transcode(UInt16, str))) == str
end
end