Debian Codegraph @

writer_test.go

raw symbols SCIP
1 package mailyakscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/
2
3 import (
4 "bytesscip-go gomod github.com/golang/go/src go1.12 bytes/"
5 "fmtscip-go gomod github.com/golang/go/src go1.12 fmt/"
6 "ioscip-go gomod github.com/golang/go/src go1.12 io/"
7 "net/smtpscip-go gomod github.com/golang/go/src go1.12 `net/smtp`/"
8 "stringsscip-go gomod github.com/golang/go/src go1.12 strings/"
9 "testingscip-go gomod github.com/golang/go/src go1.12 testing/"
10 )
11
12 // TestHTML ensures we can write to HTML as an io.Writer
13 func TestHTMLscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestHTML().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
14 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
15
16 tests := []struct {
17 name string
18 // Parameters.
19 data []string
20 }{
21 {
22 "Writer test",
23 []string{"Worst idea since someone said ‘yeah let’s take this suspiciously large " +
24 "wooden horse into Troy, statues are all the rage this season’.",
25 },
26 },
27 {
28 "Writer test multiple",
29 []string{
30 "Worst idea since someone said ‘yeah let’s take this suspiciously large " +
31 "wooden horse into Troy, statues are all the rage this season’.",
32 "Am I jumping the gun, Baldrick, or are the words 'I have a cunning plan' " +
33 "marching with ill-deserved confidence in the direction of this conversation?",
34 },
35 },
36 }
37 for _, tt := range tests {
38 tt := tt
39 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#) {
40 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
41
42 mail := Newscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/New().("", smtpscip-go gomod github.com/golang/go/src go1.12 `net/smtp`/.PlainAuthscip-go gomod github.com/golang/go/src go1.12 `net/smtp`/PlainAuth().("", "", "", ""))
43
44 for _, data := range tt.data {
45 if _, err := ioscip-go gomod github.com/golang/go/src go1.12 io/.WriteStringscip-go gomod github.com/golang/go/src go1.12 io/WriteString().(mail.HTMLscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#HTML().(), data); err != nil {
46 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. HTML() error = %v", tt.name, err)
47 continue
48 }
49 }
50
51 if !bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Equalscip-go gomod github.com/golang/go/src go1.12 bytes/Equal().([]byte(stringsscip-go gomod github.com/golang/go/src go1.12 strings/.Joinscip-go gomod github.com/golang/go/src go1.12 strings/Join().(tt.data, "")), mail.htmlscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#html..Bytesscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#Bytes().()) {
52 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. HTML() = %v, want %v", tt.name, mail.htmlscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#html..Stringscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#String().(), tt.data)
53 }
54 })
55 }
56 }
57
58 // TestPlain ensures we can write to Plain as an io.Writer
59 func TestPlainscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestPlain().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
60 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
61
62 tests := []struct {
63 name string
64 // Parameters.
65 data string
66 }{
67 {
68 "Writer test",
69 "Am I jumping the gun, Baldrick, or are the words 'I have a cunning plan' " +
70 "marching with ill-deserved confidence in the direction of this conversation?",
71 },
72 }
73 for _, tt := range tests {
74 tt := tt
75 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#) {
76 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
77
78 mail := Newscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/New().("", smtpscip-go gomod github.com/golang/go/src go1.12 `net/smtp`/.PlainAuthscip-go gomod github.com/golang/go/src go1.12 `net/smtp`/PlainAuth().("", "", "", ""))
79
80 if _, err := ioscip-go gomod github.com/golang/go/src go1.12 io/.WriteStringscip-go gomod github.com/golang/go/src go1.12 io/WriteString().(mail.Plainscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#Plain().(), tt.data); err != nil {
81 t.Fatalfscip-go gomod github.com/golang/go/src go1.12 testing/common#Fatalf().("%q. Plain() error = %v", tt.name, err)
82 }
83
84 if !bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Equalscip-go gomod github.com/golang/go/src go1.12 bytes/Equal().([]byte(tt.data), mail.plainscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#plain..Bytesscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#Bytes().()) {
85 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. Plain() = %v, want %v", tt.name, mail.plainscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#plain..Stringscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#String().(), tt.data)
86 }
87 })
88 }
89 }
90
91 // TestWritableString ensures the writable type returns a string when called
92 // with fmt.Printx(), etc
93 func TestWritableStringscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestWritableString().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
94 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
95
96 tests := []struct {
97 name string
98 // Parameters.
99 data string
100 }{
101 {
102 "String test",
103 "Baldrick, does it have to be this way? " +
104 "Our valued friendship ending with me cutting you up into strips and telling " +
105 "the prince that you walked over a very sharp cattle grid in an extremely heavy hat?",
106 },
107 }
108 for _, tt := range tests {
109 tt := tt
110 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#) {
111 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
112
113 mail := Newscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/New().("", smtpscip-go gomod github.com/golang/go/src go1.12 `net/smtp`/.PlainAuthscip-go gomod github.com/golang/go/src go1.12 `net/smtp`/PlainAuth().("", "", "", ""))
114
115 if _, err := ioscip-go gomod github.com/golang/go/src go1.12 io/.WriteStringscip-go gomod github.com/golang/go/src go1.12 io/WriteString().(mail.Plainscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#Plain().(), tt.data); err != nil {
116 t.Fatalfscip-go gomod github.com/golang/go/src go1.12 testing/common#Fatalf().("%q. Plain() error = %v", tt.name, err)
117 }
118
119 if tt.data != mail.plainscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#plain..Stringscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#String().() {
120 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. writable.String() = %v, want %v", tt.name, mail.plainscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#plain..Stringscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#String().(), tt.data)
121 }
122
123 if out := fmtscip-go gomod github.com/golang/go/src go1.12 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.12 fmt/Sprintf().("%v", mail.plainscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#plain..Stringscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#String().()); out != tt.data {
124 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. writable.String() via fmt.Sprintf = %v, want %v", tt.name, out, tt.data)
125 }
126 })
127 }
128 }
129
130 // TestPlain_String ensures we can use the string setter
131 func TestPlain_Stringscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/TestPlain_String().(t *testingscip-go gomod github.com/golang/go/src go1.12 testing/.Tscip-go gomod github.com/golang/go/src go1.12 testing/T#) {
132 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
133
134 tests := []struct {
135 name string
136 // Parameters.
137 data string
138 }{
139 {
140 "Writer test",
141 "Am I jumping the gun, Baldrick, or are the words 'I have a cunning plan' " +
142 "marching with ill-deserved confidence in the direction of this conversation?",
143 },
144 }
145 for _, tt := range tests {
146 tt := tt
147 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#) {
148 t.Parallelscip-go gomod github.com/golang/go/src go1.12 testing/T#Parallel().()
149
150 mail := Newscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/New().("", smtpscip-go gomod github.com/golang/go/src go1.12 `net/smtp`/.PlainAuthscip-go gomod github.com/golang/go/src go1.12 `net/smtp`/PlainAuth().("", "", "", ""))
151
152 if _, err := ioscip-go gomod github.com/golang/go/src go1.12 io/.WriteStringscip-go gomod github.com/golang/go/src go1.12 io/WriteString().(mail.Plainscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#Plain().(), tt.data); err != nil {
153 t.Fatalfscip-go gomod github.com/golang/go/src go1.12 testing/common#Fatalf().("%q. Plain() error = %v", tt.name, err)
154 }
155
156 if !bytesscip-go gomod github.com/golang/go/src go1.12 bytes/.Equalscip-go gomod github.com/golang/go/src go1.12 bytes/Equal().([]byte(tt.data), mail.plainscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#plain..Bytesscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#Bytes().()) {
157 t.Errorfscip-go gomod github.com/golang/go/src go1.12 testing/common#Errorf().("%q. Plain() = %v, want %v", tt.name, mail.plainscip-go gomod github.com/domodwyer/mailyak/v3 . `github.com/domodwyer/mailyak/v3`/MailYak#plain..Stringscip-go gomod github.com/golang/go/src go1.12 bytes/Buffer#String().(), tt.data)
158 }
159 })
160 }
161 }