From abdb3f8d8059af70a65c90447eeabde9ef46633f Mon Sep 17 00:00:00 2001 From: ianlmgoddard Date: Wed, 21 Apr 2021 12:39:09 +0100 Subject: [PATCH] add test to check we error when no prefix is defined --- test/anchoredinterval.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/anchoredinterval.jl b/test/anchoredinterval.jl index 75454b83..f3f920ac 100644 --- a/test/anchoredinterval.jl +++ b/test/anchoredinterval.jl @@ -585,6 +585,13 @@ using Intervals: Bounded, Ending, Beginning, canonicalize, isunbounded "AnchoredInterval{25,Char,Closed,Open}('a')" end @test sprint(show, interval) == shown + + # Error if no prefix defined for the given period type + interval = AnchoredInterval{Microsecond(-1)}(Date(dt)) + @test_throws ErrorException sprint(print, interval) + + interval = AnchoredInterval{Nanosecond(-1)}(Date(dt)) + @test_throws ErrorException sprint(print, interval) end @testset "equality" begin