diff --git a/Project.toml b/Project.toml index e74d616..71d5a61 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "CitableBase" uuid = "d6f014bd-995c-41bd-9893-703339864534" authors = ["Neel Smith "] -version = "1.2.1" +version = "1.2.2" [deps] DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" diff --git a/src/versions.jl b/src/versions.jl index bf99581..fc68779 100644 --- a/src/versions.jl +++ b/src/versions.jl @@ -1,7 +1,7 @@ """Catch-all function for `dropversion` method. $(SIGNATURES) """ -function dropversion(u::Urn) +function dropversion(u::T) where {T <: Urn} msg = string("dropversion not implemented for ", typeof(u)) @warn(msg) nothing @@ -10,7 +10,7 @@ end """Catch-all function for `addversion` method. $(SIGNATURES) """ -function addversion(u::Urn, s::AbstractString) +function addversion(u::T, s::AbstractString) where {T <: Urn} msg = string("addversion not implemented for ", typeof(u)) @warn(msg) nothing diff --git a/test/test_functiondefs.jl b/test/test_functiondefs.jl index fbbbb96..4e0306a 100644 --- a/test/test_functiondefs.jl +++ b/test/test_functiondefs.jl @@ -19,4 +19,21 @@ end u = FakeUrn("urn:fake:id.subid") @test isnothing(dropversion(u)) @test isnothing(addversion(u, "versionid")) +end + + + +@testset "Test ovveride validurn" begin + struct FakeUrn <: Urn + urn::AbstractString + end + function dropversion(u::FakeUrn) + "Success" + end + function addversion(u::FakeUrn, s) + "Success adding $s" + end + u = FakeUrn("urn:fake:id.subid") + @test dropversion(u) == "Success" + @test addversion(u, "versionid") == "Success adding versionid" end \ No newline at end of file