diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e1af050..1ea6292 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -13,6 +13,7 @@ jobs: fail-fast: false matrix: version: + - '1.0' # 1.0 is only partially tested; in the next breaking release, add [compat] 'julia = "1.6"' and drop this - '1.6' - '1' - 'nightly' diff --git a/Project.toml b/Project.toml index 45c875d..04ad672 100644 --- a/Project.toml +++ b/Project.toml @@ -1,9 +1,7 @@ name = "AbstractTrees" uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" -version = "0.4.1" authors = ["Keno Fischer "] - -[deps] +version = "0.4.2" [compat] julia = "1" diff --git a/src/AbstractTrees.jl b/src/AbstractTrees.jl index 561915b..10f8773 100644 --- a/src/AbstractTrees.jl +++ b/src/AbstractTrees.jl @@ -19,6 +19,11 @@ include("iteration.jl") include("builtins.jl") include("printing.jl") +# Julia 1.0 support (delete when we no longer support it) +if !isdefined(Base, :isnothing) + isnothing(x) = x === nothing +end + #interface export ParentLinks, StoredParents, ImplicitParents diff --git a/src/base.jl b/src/base.jl index 9a187ca..3737eec 100644 --- a/src/base.jl +++ b/src/base.jl @@ -130,7 +130,7 @@ function is not available. Equivalence is established with the `equiv` function. Note that new methods should also define `equiv` or calls may fall back to the default method. """ -isdescendant(node1, node2; equiv=(≡)) = !equiv(node1, node2) && intree(node1, node2; equiv) +isdescendant(node1, node2; equiv=(≡)) = !equiv(node1, node2) && intree(node1, node2; equiv=equiv) """ diff --git a/src/printing.jl b/src/printing.jl index f696659..3ee4546 100644 --- a/src/printing.jl +++ b/src/printing.jl @@ -259,8 +259,8 @@ function print_tree(printnode::Function, io::IO, node; end print_tree(printnode, io, child; - maxdepth, indicate_truncation, charset, printkeys, - depth=depth+1, prefix=child_prefix + maxdepth=maxdepth, indicate_truncation=indicate_truncation, charset=charset, + printkeys=printkeys, depth=depth+1, prefix=child_prefix ) end end diff --git a/test/examples.jl b/test/examples.jl index f47c1e4..8d5dd5a 100644 --- a/test/examples.jl +++ b/test/examples.jl @@ -1,4 +1,5 @@ # Ensure that we can run all files in the examples directory with no errors. +# Note: fstree doesn't work on Julia 1.0 exampledir = joinpath(dirname(@__DIR__), "examples") examples = readdir(exampledir) diff --git a/test/examples/binarytree.jl b/test/examples/binarytree.jl index 8b85db6..765bd60 100644 --- a/test/examples/binarytree.jl +++ b/test/examples/binarytree.jl @@ -1,5 +1,8 @@ using AbstractTrees +if !isdefined(Base, :isnothing) # Julia 1.0 support + using AbstractTrees: isnothing +end mutable struct BinaryNode{T} data::T diff --git a/test/examples/fstree.jl b/test/examples/fstree.jl index 1453c1c..ca8a501 100644 --- a/test/examples/fstree.jl +++ b/test/examples/fstree.jl @@ -29,7 +29,8 @@ AbstractTrees.printnode(io::IO, d::Directory) = print(io, basename(d.path)) AbstractTrees.printnode(io::IO, f::File) = print(io, basename(f.path)) function mk_tree_test_dir(f, parentdir=tempdir(); prefix="jl_") - mktempdir(parentdir; prefix) do path + # While Julia 1.0 can parse this, `mktempdir` does not support the `prefix` kw + mktempdir(parentdir; prefix=prefix) do path cd(path) do open(io -> write(io, "test1"), "f1"; write=true) mkdir("A") diff --git a/test/runtests.jl b/test/runtests.jl index 62a493a..21a7f72 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,5 +3,7 @@ using AbstractTrees, Test @testset "Builtins" begin include("builtins.jl") end @testset "Custom tree types" begin include("trees.jl") end -@testset "Printing" begin include("printing.jl") end - +if Base.VERSION >= v"1.6" + # Printing tests use `findall` variants that are not supported on Julia 1.0 + @testset "Printing" begin include("printing.jl") end +end diff --git a/test/trees.jl b/test/trees.jl index 70bf459..c3f80ba 100644 --- a/test/trees.jl +++ b/test/trees.jl @@ -88,7 +88,7 @@ end include(joinpath(@__DIR__,"examples","fstree.jl")) @testset "FSNode" begin - mk_tree_test_dir() do path + Base.VERSION >= v"1.6" && mk_tree_test_dir() do path tree = Directory(".") ls = nodevalue.((collect ∘ Leaves)(tree))