Skip to content

Commit 60e2627

Browse files
committed
AbsText Colon
1 parent 96fb8c8 commit 60e2627

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/xmlutils/findnode.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function parse_textindices(indicesstr::String)
245245
indicesExpr.head == :vect || error("give indices as a vetor e.g. [2:3], [2, 3] ,[:]")
246246
indices = eval(indicesExpr)
247247
# TODO find a better way
248-
if typeof(indices) <: Vector{UnitRange{Int64}}
248+
if typeof(indices) <: Vector{<:Union{UnitRange{Int64},Colon}}
249249
indices = indices[1]
250250
end
251251
end

test/xmlutils.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,17 @@ using AcuteML, Test
113113
@test_broken ["txt1-uu", "txt2-uu"] == findcontent(Vector{String}, "[1:2]", n, AbsText)
114114
@test_broken ["txt1-uu", "txt2-uu", "txt3-u"] == findcontent(Vector{String}, "[1:2]", n, AbsText)
115115

116+
n = createnode(AbsNormal, "p")
117+
addnode!(n, "n1", "1", AbsNormal)
118+
addnode!(n, "n2", "2", AbsNormal)
119+
addnode!(n, "n3", "3", AbsNormal)
120+
addnode!(n, "n4", "4", AbsNormal)
121+
# puts form 1 to end
122+
addnode!(n, "[:]", ["txt1", "txt2"], AbsText) # Adds text inside n1 and n2
123+
@test ["txt1", "txt2"] == findcontent(Vector{String}, "[:]", n, AbsText)
124+
updatecontent!(["txt1-u", "txt2"], "[:]", n, AbsText)
125+
@test ["txt1-u", "txt2"] == findcontent(Vector{String}, "[:]", n, AbsText)
126+
116127
n = createnode(AbsNormal, "a")
117128
addnode!(n, "1", 1, AbsText)
118129
@test 1 == findcontent(Int64, "1", n, AbsText)

0 commit comments

Comments
 (0)