From 60e2627711329c8767a4fd9c092167e40f64e6fd Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 14 Jun 2020 07:25:11 -0500 Subject: [PATCH] AbsText Colon --- src/xmlutils/findnode.jl | 2 +- test/xmlutils.jl | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/xmlutils/findnode.jl b/src/xmlutils/findnode.jl index 70c09f4..7d1f378 100644 --- a/src/xmlutils/findnode.jl +++ b/src/xmlutils/findnode.jl @@ -245,7 +245,7 @@ function parse_textindices(indicesstr::String) indicesExpr.head == :vect || error("give indices as a vetor e.g. [2:3], [2, 3] ,[:]") indices = eval(indicesExpr) # TODO find a better way - if typeof(indices) <: Vector{UnitRange{Int64}} + if typeof(indices) <: Vector{<:Union{UnitRange{Int64},Colon}} indices = indices[1] end end diff --git a/test/xmlutils.jl b/test/xmlutils.jl index ac77ece..3b39ace 100644 --- a/test/xmlutils.jl +++ b/test/xmlutils.jl @@ -113,6 +113,17 @@ using AcuteML, Test @test_broken ["txt1-uu", "txt2-uu"] == findcontent(Vector{String}, "[1:2]", n, AbsText) @test_broken ["txt1-uu", "txt2-uu", "txt3-u"] == findcontent(Vector{String}, "[1:2]", n, AbsText) + n = createnode(AbsNormal, "p") + addnode!(n, "n1", "1", AbsNormal) + addnode!(n, "n2", "2", AbsNormal) + addnode!(n, "n3", "3", AbsNormal) + addnode!(n, "n4", "4", AbsNormal) + # puts form 1 to end + addnode!(n, "[:]", ["txt1", "txt2"], AbsText) # Adds text inside n1 and n2 + @test ["txt1", "txt2"] == findcontent(Vector{String}, "[:]", n, AbsText) + updatecontent!(["txt1-u", "txt2"], "[:]", n, AbsText) + @test ["txt1-u", "txt2"] == findcontent(Vector{String}, "[:]", n, AbsText) + n = createnode(AbsNormal, "a") addnode!(n, "1", 1, AbsText) @test 1 == findcontent(Int64, "1", n, AbsText)