Skip to content

Commit

Permalink
Fix next(::GraphemeIterator) to return SubString
Browse files Browse the repository at this point in the history
This is consistent with eltype() and therefore collect().
Fixes #9261.

(cherry picked from commit f379e08)
ref #13903
  • Loading branch information
nalimilan authored and tkelman committed Nov 7, 2015
1 parent d011975 commit 61230f2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/unicode/utf8proc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function next(g::GraphemeIterator, i)
k =
c0 = c
end
return (s[i:j], k)
return (SubString(s, i, j), k)
end

==(g1::GraphemeIterator, g2::GraphemeIterator) = g1.s == g2.s
Expand Down
5 changes: 5 additions & 0 deletions test/unicode/utf8proc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,12 @@ let grphtest = (("b\u0300lahβlahb\u0302láh", ["b\u0300","l","a","h",
for (s, g) in grphtest
s_ = T(normalize_string(s, nf))
g_ = map(s -> normalize_string(s, nf), g)
# #9261
if length(s_) > 0
@test typeof(first(graphemes(s_))) == SubString{typeof(s_)}
end
grph = collect(graphemes(s_))
@test eltype(grph) == SubString{typeof(s_)}
@test grph == g_
@test length(graphemes(s_)) == length(grph)
end
Expand Down

0 comments on commit 61230f2

Please sign in to comment.