Skip to content

Commit

Permalink
Merge pull request #12641 from ScottPJones/spj/testutf8
Browse files Browse the repository at this point in the history
Add more coverage for UTF8String
  • Loading branch information
jakebolewski committed Aug 17, 2015
2 parents fc6cb99 + 3aeaff9 commit e240223
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/unicode/utf8.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,17 @@ let ch = 0x10000
end
end
end

let str = UTF8String(b"this is a test\xed\x80")
@test next(str, 15) == ('\ufffd', 16)
@test_throws BoundsError getindex(str, 0:3)
@test_throws BoundsError getindex(str, 17:18)
@test_throws BoundsError getindex(str, 2:17)
@test_throws UnicodeError getindex(str, 16:17)
@test string(Char(0x110000)) == "\ufffd"
sa = SubString{ASCIIString}("This is a silly test", 1, 14)
s8 = convert(SubString{UTF8String}, sa)
@test typeof(s8) == SubString{UTF8String}
@test s8 == "This is a sill"
@test convert(UTF8String, b"this is a test\xed\x80\x80") == "this is a test\ud000"
end

0 comments on commit e240223

Please sign in to comment.