From d1e64d99535ff15091b3df165d7602612d56c7d3 Mon Sep 17 00:00:00 2001 From: Martin Holters Date: Tue, 8 Oct 2019 16:55:28 +0200 Subject: [PATCH] Drop compat code for `codeunits` from #474 --- README.md | 4 +--- src/Compat.jl | 7 ------- test/old.jl | 3 +++ test/runtests.jl | 2 -- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 3e7667158..7b1ee49b1 100644 --- a/README.md +++ b/README.md @@ -83,9 +83,7 @@ Currently, the `@compat` macro supports the following syntaxes: * `@compat finalizer(func, obj)` with the finalizer to run as the first argument and the object to be finalized as the second ([#24605]). -* `codeunits(s)` returns an array-like view of the `UInt8` code units of - a string and `ncodeunits(s)` returns the number of code units ([#25241]). - `codeunit(s)` returns the type of the code units of `s` ([#24999]). +* `codeunit(s)` returns the type of the code units of `s` ([#24999]). * `thisind(s, i)` returns the character index for codeunit `i` ([#24414]). diff --git a/src/Compat.jl b/src/Compat.jl index c61393d21..7e32a9ce0 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -71,13 +71,6 @@ end end end -@static if !isdefined(Base, :codeunits) - codeunits(s::String) = Vector{UInt8}(s) - ncodeunits(s::Union{String,SubString{String}}) = sizeof(s) - codeunits(s::SubString{String}) = view(codeunits(s.string),1+s.offset:s.offset+sizeof(s)) - export codeunits, ncodeunits -end - @static if !isdefined(Base, :nameof) nameof(m::Module) = Base.module_name(m) nameof(f::Function) = Base.function_name(f) diff --git a/test/old.jl b/test/old.jl index 0d1332024..13cc97c83 100644 --- a/test/old.jl +++ b/test/old.jl @@ -661,3 +661,6 @@ end @test parentmodule(sin, Tuple{Int}) == Base.Math @test parentmodule(Int) == Core @test parentmodule(Array) == Core + +@test codeunits("foo") == [0x66,0x6f,0x6f] == codeunits(SubString("fooαβγ",1,3)) +@test ncodeunits("αβγ") == 6 == ncodeunits(SubString("fooαβγ",4,8)) diff --git a/test/runtests.jl b/test/runtests.jl index e082fac6e..52d4190d4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -80,8 +80,6 @@ let A = [1] @test x == 1 end -@test codeunits("foo") == [0x66,0x6f,0x6f] == codeunits(SubString("fooαβγ",1,3)) -@test ncodeunits("αβγ") == 6 == ncodeunits(SubString("fooαβγ",4,8)) @test codeunit("foo") == codeunit(SubString("fooαβγ",1,3)) == UInt8 # 0.7.0-DEV.3539