From b396060a9e93ba599e637163450160ab55140019 Mon Sep 17 00:00:00 2001 From: Andy Nowacki Date: Mon, 26 Feb 2024 09:40:08 +0000 Subject: [PATCH] channel_code_parts: Add extra tests for empty [X]FDSN channel codes Make sure that we test the path taken when a miniSEED id starts with "XFDSN:" or "FDSN:" but is empty otherwise. --- test/channel_codes.jl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/channel_codes.jl b/test/channel_codes.jl index 26a04ef..f04be5d 100644 --- a/test/channel_codes.jl +++ b/test/channel_codes.jl @@ -67,6 +67,19 @@ using Test @test LibMseed.channel_code_parts("XFDSN:___ _ _ ") == (net="", sta="", loc="", cha=" ") end + + @testset "Empty after '[X]FDSN:'" begin + @test ( + @test_logs ( + :warn, "unexpectedly short channel id" + ) LibMseed.channel_code_parts("XFDSN:") + ) == (net="", sta="XFDSN:", loc="", cha="") + @test ( + @test_logs ( + :warn, "unexpectedly short channel id" + ) LibMseed.channel_code_parts("FDSN:") + ) == (net="", sta="FDSN:", loc="", cha="") + end end @testset "_ separated" begin