From 64eb5abeff73f290c3b76aa97c6acd7ed627fa2d Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 5 Dec 2022 13:55:41 +0100 Subject: pkg/email: refactor ParsePatch Currently the function returns the values that are not being used anywhere. Refactor it. --- pkg/email/patch_test.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'pkg/email/patch_test.go') diff --git a/pkg/email/patch_test.go b/pkg/email/patch_test.go index 0919db9ca..a2be0d6c9 100644 --- a/pkg/email/patch_test.go +++ b/pkg/email/patch_test.go @@ -10,13 +10,7 @@ import ( func TestParsePatch(t *testing.T) { for _, test := range tests { t.Run(test.title, func(t *testing.T) { - title, diff, err := ParsePatch(test.text) - if err != nil { - t.Fatalf("failed to parse patch: %v", err) - } - if test.title != title { - t.Fatalf("title mismatch, want:\n%v\ngot:\n%v", test.title, title) - } + diff := ParsePatch([]byte(test.text)) if test.diff != diff { t.Fatalf("diff mismatch, want:\n%v\ngot:\n%v", test.diff, diff) } @@ -478,4 +472,14 @@ Index: usb-devel/drivers/usb/core/hub.c dev_err(hub->intfdev, "activate --> %d\n", status); `, }, + { + text: `Some +Text +Without +Any +Diff +`, + diff: "", + title: "test empty patch", + }, } -- cgit mrf-deployment