Skip to content

Commit

Permalink
Use Errof where appriate
Browse files Browse the repository at this point in the history
  • Loading branch information
flicaflow committed Nov 19, 2024
1 parent 5776729 commit ed74cae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 0 additions & 2 deletions pkg/tag/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,5 @@ func parseTag(tag string) (Tag, error) {
// and to create private tags.
// If the tag already exists it will be overridden.
func RegisterCustom(info Info) {
maybeInitTagDict()

tagDict[info.Tag] = info
}
12 changes: 6 additions & 6 deletions pkg/tag/tag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,21 @@ func TestRegisterCustom(t *testing.T) {
TagTestTag := Tag{Group: 0x0063, Element: 0x0020}
RegisterCustom(Info{
Tag: TagTestTag,
VR: "UT",
VRs: []string{"UT"},
Name: "TestTag",
VM: "1",
})

// Then the tag is now part of the tag collection
_, err = FindByName("TestTag")
if err != nil {
t.Fatalf("expected TestTag to be accessible with FindByName")
t.Errorf("expected TestTag to be accessible with FindByName")
}
info, err := Find(TagTestTag)
if err != nil {
t.Fatalf("expected TestTag to be accessible with Find")
}
if info.VR != "UT" ||
if info.VRs[0] != "UT" ||
info.Name != "TestTag" ||
info.VM != "1" {
t.Fatal("info of new registered tag is wrong")
Expand All @@ -140,14 +140,14 @@ func TestRegisterCustom(t *testing.T) {
if err != nil {
t.Fatalf("expected TestTag to be accessible with Find")
}
if info.VR != "PN" {
if info.VRs[0] != "PN" {
t.Fatal("expected PatientName VR is originally PN")
}

// When the tag is registered with different content
RegisterCustom(Info{
Tag: TagTestTag,
VR: "LO", // originally this is PN
VRs: []string{"LO"}, // originally this is PN
Name: "PatientName",
VM: "1",
})
Expand All @@ -157,7 +157,7 @@ func TestRegisterCustom(t *testing.T) {
if err != nil {
t.Fatalf("expected TestTag to be accessible with Find")
}
if info.VR != "LO" {
if info.VRs[0] != "LO" {
t.Fatal("expected the VR to have changed to LO")
}
})
Expand Down

0 comments on commit ed74cae

Please sign in to comment.