Skip to content

Commit 69faf4e

Browse files
authored
Merge pull request JuliaCollections#110 from JuliaCollections/teh/j1.0
Unbreak Julia 1.0
2 parents 8970a89 + 46a51f7 commit 69faf4e

File tree

10 files changed

+21
-10
lines changed

10 files changed

+21
-10
lines changed

.github/workflows/CI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
version:
16+
- '1.0' # 1.0 is only partially tested; in the next breaking release, add [compat] 'julia = "1.6"' and drop this
1617
- '1.6'
1718
- '1'
1819
- 'nightly'

Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
name = "AbstractTrees"
22
uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
3-
version = "0.4.1"
43
authors = ["Keno Fischer <[email protected]>"]
5-
6-
[deps]
4+
version = "0.4.2"
75

86
[compat]
97
julia = "1"

src/AbstractTrees.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ include("iteration.jl")
1919
include("builtins.jl")
2020
include("printing.jl")
2121

22+
# Julia 1.0 support (delete when we no longer support it)
23+
if !isdefined(Base, :isnothing)
24+
isnothing(x) = x === nothing
25+
end
26+
2227

2328
#interface
2429
export ParentLinks, StoredParents, ImplicitParents

src/base.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function is not available.
130130
Equivalence is established with the `equiv` function. Note that new methods should also define `equiv` or calls
131131
may fall back to the default method.
132132
"""
133-
isdescendant(node1, node2; equiv=()) = !equiv(node1, node2) && intree(node1, node2; equiv)
133+
isdescendant(node1, node2; equiv=()) = !equiv(node1, node2) && intree(node1, node2; equiv=equiv)
134134

135135

136136
"""

src/printing.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ function print_tree(printnode::Function, io::IO, node;
259259
end
260260

261261
print_tree(printnode, io, child;
262-
maxdepth, indicate_truncation, charset, printkeys,
263-
depth=depth+1, prefix=child_prefix
262+
maxdepth=maxdepth, indicate_truncation=indicate_truncation, charset=charset,
263+
printkeys=printkeys, depth=depth+1, prefix=child_prefix
264264
)
265265
end
266266
end

test/examples.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Ensure that we can run all files in the examples directory with no errors.
2+
# Note: fstree doesn't work on Julia 1.0
23

34
exampledir = joinpath(dirname(@__DIR__), "examples")
45
examples = readdir(exampledir)

test/examples/binarytree.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
using AbstractTrees
22

3+
if !isdefined(Base, :isnothing) # Julia 1.0 support
4+
using AbstractTrees: isnothing
5+
end
36

47
mutable struct BinaryNode{T}
58
data::T

test/examples/fstree.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ AbstractTrees.printnode(io::IO, d::Directory) = print(io, basename(d.path))
2929
AbstractTrees.printnode(io::IO, f::File) = print(io, basename(f.path))
3030

3131
function mk_tree_test_dir(f, parentdir=tempdir(); prefix="jl_")
32-
mktempdir(parentdir; prefix) do path
32+
# While Julia 1.0 can parse this, `mktempdir` does not support the `prefix` kw
33+
mktempdir(parentdir; prefix=prefix) do path
3334
cd(path) do
3435
open(io -> write(io, "test1"), "f1"; write=true)
3536
mkdir("A")

test/runtests.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ using AbstractTrees, Test
33

44
@testset "Builtins" begin include("builtins.jl") end
55
@testset "Custom tree types" begin include("trees.jl") end
6-
@testset "Printing" begin include("printing.jl") end
7-
6+
if Base.VERSION >= v"1.6"
7+
# Printing tests use `findall` variants that are not supported on Julia 1.0
8+
@testset "Printing" begin include("printing.jl") end
9+
end

test/trees.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ end
8888
include(joinpath(@__DIR__,"examples","fstree.jl"))
8989

9090
@testset "FSNode" begin
91-
mk_tree_test_dir() do path
91+
Base.VERSION >= v"1.6" && mk_tree_test_dir() do path
9292
tree = Directory(".")
9393

9494
ls = nodevalue.((collect Leaves)(tree))

0 commit comments

Comments
 (0)