Skip to content

Commit ec2d696

Browse files
authored
Test more UTF-8 characters in transcode (#55580)
Previous test just covered 2-byte UTF8. This one should hit more branches for ASCII and 3-byte UTF-8.
1 parent 6440292 commit ec2d696

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/strings/basic.jl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,8 +1392,15 @@ end
13921392
end
13931393

13941394
@testset "transcode" begin
1395-
str = "αβγ"
1396-
@test transcode(String, transcode(UInt16, str)) == str
1397-
@test transcode(String, transcode(UInt16, transcode(UInt8, str))) == str
1398-
@test transcode(String, transcode(UInt8, transcode(UInt16, str))) == str
1395+
# string starting with an ASCII character
1396+
str_1 = "zβγ"
1397+
# string starting with a 2 byte UTF-8 character
1398+
str_2 = "αβγ"
1399+
# string starting with a 3 byte UTF-8 character
1400+
str_3 = "आख"
1401+
@testset for str in (str_1, str_2, str_3)
1402+
@test transcode(String, transcode(UInt16, str)) == str
1403+
@test transcode(String, transcode(UInt16, transcode(UInt8, str))) == str
1404+
@test transcode(String, transcode(UInt8, transcode(UInt16, str))) == str
1405+
end
13991406
end

0 commit comments

Comments
 (0)