github.com/google/syzkaller@v0.0.0-20251211124644-a066d2bc4b02/syz-cluster/series-tracker/main_test.go (about) 1 // Copyright 2025 syzkaller project authors. All rights reserved. 2 // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. 3 4 package main 5 6 import ( 7 "testing" 8 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func TestSeriesProcessor(t *testing.T) { 13 emails := []string{ 14 `Date: Sun, 7 May 2017 19:54:00 -0700 15 Message-ID: <123> 16 Subject: test subject 17 From: Bob <bob@example.com> 18 To: A <a@a.com> 19 Cc: B <b@b.com>, C <b@b.com> 20 21 first body`, 22 `Date: Sun, 7 May 2017 19:55:00 -0700 23 Message-ID: <234> 24 Subject: test subject2 25 From: Bob <bob@example.com> 26 To: A <a@a.com> 27 Cc: D <d@d.com> 28 29 second body`, 30 } 31 bodies := []string{"first body", "second body"} 32 33 sp := seriesProcessor{} 34 for i, raw := range emails { 35 body, err := sp.Process([]byte(raw)) 36 if err != nil { 37 t.Fatal(err) 38 } 39 assert.Equal(t, []byte(bodies[i]), body) 40 } 41 assert.Equal(t, []string{ 42 "a@a.com", "b@b.com", 43 "bob@example.com", "d@d.com", 44 }, sp.Emails()) 45 } 46 47 func TestLoreLink(t *testing.T) { 48 for id, link := range map[string]string{ 49 "<id@domain>": "https://lore.kernel.org/all/id@domain", 50 "id@domain": "https://lore.kernel.org/all/id@domain", 51 } { 52 assert.Equal(t, link, loreLink(id), "id=%q", id) 53 } 54 }