Skip to content

Commit

Permalink
Test more UTF-8 characters in transcode (JuliaLang#55580)
Browse files Browse the repository at this point in the history
Previous test just covered 2-byte UTF8. This one should hit more
branches for ASCII and 3-byte UTF-8.
  • Loading branch information
kshyatt authored Aug 28, 2024
1 parent 6440292 commit ec2d696
Showing 1 changed file with 11 additions and 4 deletions.
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

0 comments on commit ec2d696

Please sign in to comment.