Skip to content

Commit

Permalink
AbsText Colon
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Jun 14, 2020
1 parent 96fb8c8 commit 60e2627
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/xmlutils/findnode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions test/xmlutils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 60e2627

Please sign in to comment.