diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2019-05-13 14:15:14 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-05-13 14:15:14 +0200 |
| commit | 69423a1d41ce792ddad1c5636b61df7cb2e91440 (patch) | |
| tree | cedd1e5c0d0d4c098dee2679d510509e56447176 /pkg/email/parser_test.go | |
| parent | 92d5fb8ed39c68c9741df483d5e50f619dacffd9 (diff) | |
pkg/email: allow commands in subject
Several users attempted this and there does not seem
to be any reason to not allow this.
So parse out command from subject as well.
Diffstat (limited to 'pkg/email/parser_test.go')
| -rw-r--r-- | pkg/email/parser_test.go | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/pkg/email/parser_test.go b/pkg/email/parser_test.go index 0085adeb9..ba027f8e7 100644 --- a/pkg/email/parser_test.go +++ b/pkg/email/parser_test.go @@ -15,13 +15,13 @@ import ( func TestExtractCommand(t *testing.T) { for i, test := range extractCommandTests { t.Run(fmt.Sprint(i), func(t *testing.T) { - cmd, str, args := extractCommand([]byte(test.body)) + cmd, str, args := extractCommand(test.body) if cmd != test.cmd || str != test.str || !reflect.DeepEqual(args, test.args) { t.Logf("expect: %v %q %q", test.cmd, test.str, test.args) t.Logf("got : %v %q %q", cmd, str, args) t.Fail() } - cmd, str, args = extractCommand([]byte(strings.Replace(test.body, "\n", "\r\n", -1))) + cmd, str, args = extractCommand(strings.Replace(test.body, "\n", "\r\n", -1)) if cmd != test.cmd || str != test.str || !reflect.DeepEqual(args, test.args) { t.Logf("expect: %v %q %q", test.cmd, test.str, test.args) t.Logf("got : %v %q %q", cmd, str, args) @@ -656,4 +656,23 @@ When freeing a lockf struct that already is part of a linked list, make sure to CommandStr: "fix:", CommandArgs: "When freeing a lockf struct that already is part of a linked list, make sure to", }}, + + {`Date: Sun, 7 May 2017 19:54:00 -0700 +Message-ID: <123> +Subject: #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master +From: bob@example.com +To: syzbot <foo+4564456@bar.com> + +nothing to see here`, + Email{ + BugID: "4564456", + MessageID: "<123>", + Subject: "#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master", + From: "<bob@example.com>", + Cc: []string{"bob@example.com"}, + Body: `nothing to see here`, + Command: CmdTest, + CommandStr: "test:", + CommandArgs: "git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git master", + }}, } |
