Skip to content

Commit

Permalink
remove Compat for pre-v0.5 versions
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Dec 14, 2016
1 parent e377f5a commit f13ac1e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ language: julia
julia:
- nightly
- 0.5
- 0.4
- 0.3
os:
- linux
notifications:
Expand Down
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
julia 0.3
Compat
julia 0.5
13 changes: 6 additions & 7 deletions src/Glob.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
VERSION > v"0.4" && __precompile__()
__precompile__()

module Glob

import Base: ismatch, match, readdir, show
isdefined(Base, :) || const = Base.:$ # xor compat for v0.6

export glob, @fn_str, @fn_mstr, @glob_str, @glob_mstr

Expand All @@ -12,9 +13,6 @@ const NOESCAPE = 1 << 2 # e -- Do not treat backslash (\) as a special character
const PATHNAME = 1 << 3 # d -- Slash (/) character must be exactly matched by a slash (/) character
const EXTENDED = 1 << 4 # x -- Support extended (bash-like) features

using Compat
import Compat.String

immutable FilenameMatch{S<:AbstractString}
pattern::S
options::UInt32
Expand Down Expand Up @@ -45,6 +43,7 @@ function show(io::IO, fn::FilenameMatch)
(fn.options&NOESCAPE)!=0 && print(io, 'e')
(fn.options&PATHNAME)!=0 && print(io, 'd')
(fn.options&EXTENDED)!=0 && print(io, 'x')
nothing
end

function ismatch(fn::FilenameMatch, s::AbstractString)
Expand Down Expand Up @@ -215,7 +214,7 @@ function _match(pat::AbstractString, i0, c::Char, caseless::Bool, extended::Bool
while !done(pat,i)
mc, i = next(pat, i)
if (mc == ']') & notfirst
return (i, true, match$negate)
return (i, true, match negate)
end
notfirst = true
if (mc == '[')
Expand Down Expand Up @@ -243,7 +242,7 @@ function _match(pat::AbstractString, i0, c::Char, caseless::Bool, extended::Bool
mc2, j = next(pat, j)
if mc2 == ']'
match |= ((cl == mc) | (cu == mc) | (c == '-'))
return (j, true, match$negate)
return (j, true, match negate)
end
if mc2 == '['
mc2, j, valid, match2 = _match_bracket(pat, mc2, j, cl, cu)
Expand Down Expand Up @@ -285,7 +284,7 @@ function GlobMatch(pattern::AbstractString)
if !isleaftype(S)
S = Any
else
@compat S = Union{S, FilenameMatch{S}}
S = Union{S, FilenameMatch{S}}
end
glob = Array(S, length(pat))
extended = false
Expand Down
14 changes: 1 addition & 13 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ module GlobTest
include("../src/Glob.jl")
using .Glob
using Base.Test
using Compat

if VERSION < v"0.3-"
macro test_throws(a,b)
:( Base.Test.@test_throws($b) )
end
end

macro test_types(arr, types)
quote
Expand Down Expand Up @@ -197,12 +190,7 @@ function test_string(x1)
"\n\nstringify: ", x2))
end

if VERSION > v"0.4-dev"
test_string("""Glob.GlobMatch(Any["base",r"h\.+"])""")
else
test_string("""Glob.GlobMatch({"base",r"h\.+"})""")
end

test_string("""Glob.GlobMatch(Any["base",r"h\.+"])""")
test_string("""glob"base/*/a/[b]\"""")
test_string("""fn"base/*/a/[b]\"ipedx""")
test_string("""fn"base/*/a/[b]\"""")
Expand Down

0 comments on commit f13ac1e

Please sign in to comment.