Debian Codegraph @

setters_test.go

raw symbols SCIP
1 package mailyakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/
2
3 import (
4 "reflectscip-go gomod github.com/golang/go/src go1.12 reflect/"
5 "regexpscip-go gomod github.com/golang/go/src go1.12 regexp/"
6 "testingscip-go gomod github.com/golang/go/src go1.12 testing/"
7 )
8
9 func TestMailYakToscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakTo().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
10 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
11
12 tests := []struct {
13 // Test description.
14 name string
15 // Parameters.
16 addrs []string
17 // Want
18 want []string
19 }{
20 {
21 "Single email (without name)",
22 []string{"[email protected]"},
23 []string{"[email protected]"},
24 },
25 {
26 "Single email (with name)",
27 []string{"Dom <[email protected]>"},
28 []string{"Dom <[email protected]>"},
29 },
30 {
31 "Multiple email",
32 []string{"Dom <[email protected]>", "[email protected]"},
33 []string{"Dom <[email protected]>", "[email protected]"},
34 },
35 {
36 "Empty last",
37 []string{"[email protected]", "[email protected]", ""},
38 []string{"[email protected]", "[email protected]"},
39 },
40 {
41 "Empty Middle",
42 []string{"[email protected]", "", "[email protected]"},
43 []string{"[email protected]", "[email protected]"},
44 },
45 }
46 for _, tt := range tests {
47 tt := tt
48 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
49 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
50
51 m := &MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{
52 toAddrsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#toAddrs.: []string{},
53 trimRegexscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#trimRegex.: regexpscip-go gomod github.com/golang/go/src go1.12 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.12 regexp/MustCompile().("\r?\n"),
54 }
55 m.Toscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#To().(tt.addrs...)
56
57 if !reflectscip-go gomod github.com/golang/go/src go1.12 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.12 reflect/DeepEqual().(m.toAddrsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#toAddrs., tt.want) {
58 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.To() = %v, want %v", tt.name, m.toAddrsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#toAddrs., tt.want)
59 }
60 })
61 }
62 }
63
64 func TestMailYakBccscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakBcc().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
65 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
66
67 tests := []struct {
68 // Test description.
69 name string
70 // Parameters.
71 addrs []string
72 // Want
73 want []string
74 }{
75 {
76 "Single email (without name)",
77 []string{"[email protected]"},
78 []string{"[email protected]"},
79 },
80 {
81 "Single email (with name)",
82 []string{"Dom <[email protected]>"},
83 []string{"Dom <[email protected]>"},
84 },
85 {
86 "Multiple email",
87 []string{"Dom <[email protected]>", "[email protected]"},
88 []string{"Dom <[email protected]>", "[email protected]"},
89 },
90 {
91 "Empty last",
92 []string{"[email protected]", "[email protected]", ""},
93 []string{"[email protected]", "[email protected]"},
94 },
95 {
96 "Empty Middle",
97 []string{"[email protected]", "", "[email protected]"},
98 []string{"[email protected]", "[email protected]"},
99 },
100 }
101 for _, tt := range tests {
102 tt := tt
103 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
104 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
105
106 m := &MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{
107 bccAddrsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#bccAddrs.: []string{},
108 trimRegexscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#trimRegex.: regexpscip-go gomod github.com/golang/go/src go1.12 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.12 regexp/MustCompile().("\r?\n"),
109 }
110 m.Bccscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#Bcc().(tt.addrs...)
111
112 if !reflectscip-go gomod github.com/golang/go/src go1.12 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.12 reflect/DeepEqual().(m.bccAddrsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#bccAddrs., tt.want) {
113 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.Bcc() = %v, want %v", tt.name, m.bccAddrsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#bccAddrs., tt.want)
114 }
115 })
116 }
117 }
118
119 func TestMailYakCcscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakCc().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
120 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
121
122 tests := []struct {
123 // Test description.
124 name string
125 // Parameters.
126 addrs []string
127 // Want
128 want []string
129 }{
130 {
131 "Single email (without name)",
132 []string{"[email protected]"},
133 []string{"[email protected]"},
134 },
135 {
136 "Single email (with name)",
137 []string{"Dom <[email protected]>"},
138 []string{"Dom <[email protected]>"},
139 },
140 {
141 "Multiple email",
142 []string{"Dom <[email protected]>", "[email protected]"},
143 []string{"Dom <[email protected]>", "[email protected]"},
144 },
145 {
146 "Empty last",
147 []string{"[email protected]", "[email protected]", ""},
148 []string{"[email protected]", "[email protected]"},
149 },
150 {
151 "Empty Middle",
152 []string{"[email protected]", "", "[email protected]"},
153 []string{"[email protected]", "[email protected]"},
154 },
155 }
156 for _, tt := range tests {
157 tt := tt
158 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
159 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
160
161 m := &MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{
162 ccAddrsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#ccAddrs.: []string{},
163 trimRegexscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#trimRegex.: regexpscip-go gomod github.com/golang/go/src go1.12 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.12 regexp/MustCompile().("\r?\n"),
164 }
165 m.Ccscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#Cc().(tt.addrs...)
166
167 if !reflectscip-go gomod github.com/golang/go/src go1.12 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.12 reflect/DeepEqual().(m.ccAddrsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#ccAddrs., tt.want) {
168 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.Cc() = %v, want %v", tt.name, m.ccAddrsscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#ccAddrs., tt.want)
169 }
170 })
171 }
172 }
173
174 func TestMailYakSubjectscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakSubject().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
175 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
176
177 tests := []struct {
178 // Test description.
179 name string
180 // Parameters.
181 subject string
182 // Want
183 want string
184 }{
185 {
186 "ASCII",
187 "Banana\r\n",
188 "Banana",
189 },
190 {
191 "Q-encoded",
192 "🍌\r\n",
193 "=?UTF-8?q?=F0=9F=8D=8C?=",
194 },
195 }
196 for _, tt := range tests {
197 tt := tt
198 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
199 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
200
201 m := &MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{
202 trimRegexscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#trimRegex.: regexpscip-go gomod github.com/golang/go/src go1.12 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.12 regexp/MustCompile().("\r?\n"),
203 }
204 m.Subjectscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#Subject().(tt.subject)
205
206 if !reflectscip-go gomod github.com/golang/go/src go1.12 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.12 reflect/DeepEqual().(m.subjectscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#subject., tt.want) {
207 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.Subject() = %v, want %v", tt.name, m.subjectscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#subject., tt.want)
208 }
209 })
210 }
211 }
212
213 func TestMailYakFromNamescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakFromName().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
214 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
215
216 tests := []struct {
217 // Test description.
218 name string
219 // Parameters.
220 from string
221 // Want
222 want string
223 }{
224 {
225 "ASCII",
226 "Goat\r\n",
227 "Goat",
228 },
229 {
230 "Q-encoded",
231 "🐐",
232 "=?UTF-8?q?=F0=9F=90=90?=",
233 },
234 }
235 for _, tt := range tests {
236 tt := tt
237 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
238 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
239
240 m := &MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{
241 trimRegexscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#trimRegex.: regexpscip-go gomod github.com/golang/go/src go1.12 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.12 regexp/MustCompile().("\r?\n"),
242 }
243 m.FromNamescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#FromName().(tt.from)
244
245 if !reflectscip-go gomod github.com/golang/go/src go1.12 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.12 reflect/DeepEqual().(m.fromNamescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#fromName., tt.want) {
246 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.Subject() = %v, want %v", tt.name, m.fromNamescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#fromName., tt.want)
247 }
248 })
249 }
250 }
251
252 func TestMailYakAddHeaderscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakAddHeader().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
253 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
254
255 tests := []struct {
256 // Test description.
257 name string
258 // Parameters.
259 from map[string][]string
260 // Want
261 want map[string][]string
262 }{
263 {
264 "ASCII",
265 map[string][]string{
266 "List-Unsubscribe": {"http://example.com"},
267 "X-NASTY": {"true\r\nBcc: [email protected]"},
268 },
269 map[string][]string{
270 "List-Unsubscribe": {"http://example.com"},
271 "X-NASTY": {"trueBcc: [email protected]"},
272 },
273 },
274 {
275 "Q-encoded",
276 map[string][]string{
277 "X-BEETHOVEN": {"für Elise"},
278 },
279 map[string][]string{
280 "X-BEETHOVEN": {"=?UTF-8?q?f=C3=BCr_Elise?="},
281 },
282 },
283 {
284 "Multi",
285 map[string][]string{
286 "X-MailGun-Tag": {"marketing", "transactional"},
287 },
288 map[string][]string{
289 "X-MailGun-Tag": {"marketing", "transactional"},
290 },
291 },
292 }
293 for _, tt := range tests {
294 tt := tt
295 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
296 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
297
298 m := &MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{
299 headersscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#headers.: map[string][]string{},
300 trimRegexscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#trimRegex.: regexpscip-go gomod github.com/golang/go/src go1.12 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.12 regexp/MustCompile().("\r?\n"),
301 }
302
303 for k, values := range tt.from {
304 for _, v := range values {
305 m.AddHeaderscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#AddHeader().(k, v)
306 }
307 }
308
309 if !reflectscip-go gomod github.com/golang/go/src go1.12 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.12 reflect/DeepEqual().(m.headersscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#headers., tt.want) {
310 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.AddHeader() = %v, want %v", tt.name, m.headersscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#headers., tt.want)
311 }
312 })
313 }
314 }
315
316 func TestMailYakLocalNamescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestMailYakLocalName().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
317 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
318
319 tests := []struct {
320 // Test description.
321 name string
322 // Parameters.
323 from string
324 // Want
325 want string
326 }{
327 {
328 "empty",
329 "",
330 "",
331 },
332 {
333 "ASCII",
334 "example.com\r\n",
335 "example.com",
336 },
337 }
338 for _, tt := range tests {
339 tt := tt
340 t.Runscip-go gomod github.com/golang/go/src go1.12 testing/T#Run().(tt.name, func(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
341 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
342
343 m := &MailYakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#{
344 headersscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#headers.: map[string][]string{},
345 trimRegexscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#trimRegex.: regexpscip-go gomod github.com/golang/go/src go1.12 regexp/.MustCompilescip-go gomod github.com/golang/go/src go1.12 regexp/MustCompile().("\r?\n"),
346 }
347
348 m.LocalNamescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#LocalName().(tt.from)
349
350 if !reflectscip-go gomod github.com/golang/go/src go1.12 reflect/.DeepEqualscip-go gomod github.com/golang/go/src go1.12 reflect/DeepEqual().(m.localNamescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#localName., tt.want) {
351 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. MailYak.LocalName() = %v, want %v", tt.name, m.localNamescip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#localName., tt.want)
352 }
353 })
354 }
355 }