From 58020a23373a1f68268dab3bf39eec0e346850ac Mon Sep 17 00:00:00 2001 From: Julio Capote Date: Thu, 31 Oct 2024 12:21:00 -0400 Subject: [PATCH] failing test --- src/net/textproto/header_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/net/textproto/header_test.go b/src/net/textproto/header_test.go index de9405ca868..255e79a1301 100644 --- a/src/net/textproto/header_test.go +++ b/src/net/textproto/header_test.go @@ -4,7 +4,9 @@ package textproto -import "testing" +import ( + "testing" +) type canonicalHeaderKeyTest struct { in, out string @@ -33,6 +35,17 @@ var canonicalHeaderKeyTests = []canonicalHeaderKeyTest{ {"foo bar", "foo bar"}, } +func TestNilMapSetOrAdd(t *testing.T) { + defer func() { + if r := recover(); r != nil { + t.Errorf("nil MIMEHeader caused panic: %v", r) + } + }() + var h MIMEHeader + h.Set("foo", "bar") + h.Add("biz", "boo") +} + func TestCanonicalMIMEHeaderKey(t *testing.T) { for _, tt := range canonicalHeaderKeyTests { if s := CanonicalMIMEHeaderKey(tt.in); s != tt.out {