package main import "testing" func TestStringAnonSettings_Apply(t *testing.T) { t.Run("Not replaced when nil", func(t *testing.T) { title := "Test" var anonTitle *StringAnonSettings = nil if anonTitle.Apply(title) != title { t.Fatal("The title should be unchanged.") } }) t.Run("Not replaced when empty", func(t *testing.T) { title := "Test" var anonTitle *StringAnonSettings = &StringAnonSettings{ReplaceWith: ""} if anonTitle.Apply(title) != title { t.Fatal("The title should be unchanged.") } }) }