From 152dd65b2a10982b61d2630b397707ba83b59f3a Mon Sep 17 00:00:00 2001 From: Neel Smith Date: Tue, 16 Jan 2024 00:34:45 -0500 Subject: [PATCH] Fixes a bug in collapsePassageTo --- Project.toml | 2 +- src/urnmanipulation.jl | 2 +- test/test_urn_manipulation.jl | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 34bd1d5..454aa0d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "CitableText" uuid = "41e66566-473b-49d4-85b7-da83b66615d8" authors = ["Neel Smith "] -version = "0.16.1" +version = "0.16.2" [deps] diff --git a/src/urnmanipulation.jl b/src/urnmanipulation.jl index 305e508..e9d06f4 100644 --- a/src/urnmanipulation.jl +++ b/src/urnmanipulation.jl @@ -171,7 +171,7 @@ function collapsePassageTo(u::CtsUrn, count::Int64)::CtsUrn newpassageparts = passageparts(u)[1] push!(newcomponents, newpassageparts) else - newpassageparts = passageparts(u)[1,count] + newpassageparts = passageparts(u)[1:count] push!(newcomponents,join(newpassageparts,".")) end CtsUrn(join(newcomponents,":")) diff --git a/test/test_urn_manipulation.jl b/test/test_urn_manipulation.jl index 966943f..7572509 100644 --- a/test/test_urn_manipulation.jl +++ b/test/test_urn_manipulation.jl @@ -58,6 +58,11 @@ end @test collapsePassageTo(u2digits, 1) |> passagecomponent == "24" + + longer = CtsUrn("urn:cts:greekLit:tlg1799.tlg001:1.1.construction.2") + level2 = collapsePassageTo(longer, 2) + @test passagecomponent(level2) == "1.1" + end