Skip to content

Commit

Permalink
Add better messages and tests
Browse files Browse the repository at this point in the history
Fix redirection of stderr
  • Loading branch information
ScottPJones committed Jul 30, 2015
1 parent 02a669a commit 7985e00
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 14 deletions.
50 changes: 38 additions & 12 deletions base/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -527,18 +527,6 @@ function start_timer(t, d, r)
error("start_timer is deprecated. Use Timer(callback, delay, repeat) instead.")
end

# 11551
function utf16_is_surrogate(chr::UInt16)
depwarn("utf16_is_surrogate was undocumented and unexported, and has been removed",
:utf16_is_surrogate)
Base.is_surrogate_codeunit(chr)
end
function utf16_get_supplementary(lead::UInt16, trail::UInt16)
depwarn("utf16_get_supplementary was undocumented and unexported, and has been removed",
:utf16_get_supplementary)
Base.get_supplementary(lead, trail)
end

const UnionType = Union
export UnionType

Expand All @@ -551,6 +539,44 @@ end

export MathConst, @math_const

# 11551
function utf16_is_surrogate(chr::UInt16)
depwarn("""
Base.utf16_is_surrogate was undocumented and unexported,
and has been removed. Use Base.is_surrogate_codeunit(chr::Unsigned) instead,
however it is also undocumented and unexported, and may change in the future.
""",
symbol("utf16_is_surrogate"))
Base.is_surrogate_codeunit(chr)
end
function utf16_is_lead(chr::UInt16)
depwarn("""
Base.utf16_is_lead was undocumented and unexported,
and has been removed. Use Base.is_surrogate_lead(chr::Unsigned) instead,
however is is also undocumented and unexported, and may change in the future.
""",
symbol("utf16_is_lead"))
Base.is_surrogate_lead(chr)
end
function utf16_is_trail(chr::UInt16)
depwarn("""
Base.utf16_is_trail was undocumented and unexported,
and has been removed. Use Base.is_surrogate_trail(chr::Unsigned) instead,
however it is also undocumented and unexported, and may change in the future.
""",
symbol("utf16_is_trail"))
Base.is_surrogate_trail(chr)
end
function utf16_get_supplementary(lead::UInt16, trail::UInt16)
depwarn("""
Base.utf16_get_supplementary was undocumented and unexported,
and has been removed. Use Base.get_supplementary(lead::Unsigned, trail::Unsigned) instead,
however it is also undocumented and unexported, and may change in the future.
""",
symbol("utf16_get_supplementary"))
Base.get_supplementary(lead, trail)
end

# 11280, mmap

export msync
Expand Down
4 changes: 2 additions & 2 deletions test/choosetests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function choosetests(choices = [])
"arrayops", "tuple", "subarray", "reduce", "reducedim", "random",
"abstractarray", "intfuncs", "simdloop", "blas", "sparse",
"bitarray", "copy", "math", "fastmath", "functional",
"operators", "path", "ccall", "parse", "loading",
"operators", "path", "ccall", "parse", "loading", "deprecated",
"bigint", "sorting", "statistics", "spawn", "backtrace",
"priorityqueue", "file", "mmap", "version", "resolve",
"pollfd", "mpfr", "broadcast", "complex", "socket",
Expand All @@ -32,7 +32,7 @@ function choosetests(choices = [])
"nullable", "meta", "profile", "libgit2", "docs", "markdown",
"base64", "serialize", "functors", "misc",
"enums", "cmdlineargs", "i18n", "workspace", "libdl", "int",
"intset","floatfuncs"
"intset", "floatfuncs"
]

if Base.USE_GPL_LIBS
Expand Down
19 changes: 19 additions & 0 deletions test/deprecated.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

if (Base.JLOptions()).depwarn > 1
@test_throws ErrorException Base.utf16_is_surrogate(0xdc00)
@test_throws ErrorException Base.utf16_is_lead(0xd800)
@test_throws ErrorException Base.utf16_is_trail(0xdc00)
@test_throws ErrorException Base.utf16_get_supplementary(0xd800, 0xdc00)
else
olderr = STDERR
try
rd, wr = redirect_stderr()
@test Base.utf16_is_surrogate(0xdc00) == true
@test Base.utf16_is_lead(0xd800) == true
@test Base.utf16_is_trail(0xdc00) == true
@test Base.utf16_get_supplementary(0xd800, 0xdc00) == 0x10000
finally
redirect_stderr(olderr)
end
end

0 comments on commit 7985e00

Please sign in to comment.