Skip to content

Commit

Permalink
update isassigned for invalid Chars (#25473)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored Jan 10, 2018
1 parent bc56748 commit 9cdd887
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion base/strings/unicode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ julia> isassigned('\\x01')
true
```
"""
isassigned(c) = category_code(c) != UTF8PROC_CATEGORY_CN
isassigned(c) = UTF8PROC_CATEGORY_CN < category_code(c) <= UTF8PROC_CATEGORY_CO

## libc character class predicates ##

Expand Down
13 changes: 9 additions & 4 deletions stdlib/Unicode/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,16 @@ end
@test_throws ArgumentError normalize("\u006e\u0303", compose=false, stripmark=true)
end

@testset "fastplus" begin
@test lowercase('A') == 'a'
@test uppercase('a') == 'A'

@testset "isassigned" begin
@test isassigned('\x00')
@test isassigned('A')
@test isassigned('α')
@test isassigned('')
@test !isassigned('\ufffe')
@test !isassigned('\uffff')
@test !isassigned("\xf4\x90\x80\x80"[1])
@test !isassigned("\xf7\xbf\xbf\xbf"[1])
@test !isassigned("\xff"[1])
end

@testset "isspace" begin
Expand Down

0 comments on commit 9cdd887

Please sign in to comment.