Debian Codegraph @

debian/patches/deactivate-some-tests.patch

raw symbols SCIP
1 Description: deactivate tests with unavailable test data
2 Author: Thorsten Alteholz <[email protected]>
3 Index: golang-github-ua-parser-uap-go/uaparser/parsing_test.go
4 ===================================================================
5 --- golang-github-ua-parser-uap-go.orig/uaparser/parsing_test.go 2020-01-12 23:27:25.864207724 +0000
6 +++ golang-github-ua-parser-uap-go/uaparser/parsing_test.go 2020-01-13 00:14:46.211574909 +0000
7 @@ -10,101 +10,101 @@
8
9 var testParser *Parser
10
11 -func init() {
12 - var err error
13 - testParser, err = New("../uap-core/regexes.yaml")
14 - if err != nil {
15 - log.Fatal(err)
16 - }
17 -}
18 -
19 -func TestOSParsing(t *testing.T) {
20 - var YAMLTestCases struct {
21 - Cases []struct {
22 - Input string `yaml:"user_agent_string"`
23 - Expected Os `yaml:",inline"`
24 - } `yaml:"test_cases"`
25 - }
26 -
27 - for _, filepath := range []string{"../uap-core/test_resources/additional_os_tests.yaml", "../uap-core/tests/test_os.yaml"} {
28 - unmarshalResourceTestFile(filepath, &YAMLTestCases)
29 -
30 - for _, c := range YAMLTestCases.Cases {
31 - actual := testParser.ParseOs(c.Input)
32 - if got, want := *actual, c.Expected; got != want {
33 - t.Fatalf("got %#v\n want %#v\n", got, want)
34 - }
35 - }
36 - }
37 -}
38 +//func init() {
39 +// var err error
40 +// testParser, err = New("../uap-core/regexes.yaml")
41 +// if err != nil {
42 +// log.Fatal(err)
43 +// }
44 +//}
45 +
46 +//func TestOSParsing(t *testing.T) {
47 +// var YAMLTestCases struct {
48 +// Cases []struct {
49 +// Input string `yaml:"user_agent_string"`
50 +// Expected Os `yaml:",inline"`
51 +// } `yaml:"test_cases"`
52 +// }
53 +//
54 +// for _, filepath := range []string{"../uap-core/test_resources/additional_os_tests.yaml", "../uap-core/tests/test_os.yaml"} {
55 +// unmarshalResourceTestFile(filepath, &YAMLTestCases)
56 +//
57 +// for _, c := range YAMLTestCases.Cases {
58 +// actual := testParser.ParseOs(c.Input)
59 +// if got, want := *actual, c.Expected; got != want {
60 +// t.Fatalf("got %#v\n want %#v\n", got, want)
61 +// }
62 +// }
63 +// }
64 +//}
65
66 func TestReadsInteralYAML(t *testing.T) {
67 _ = NewFromSaved() // should not panic
68 }
69
70 -func TestUAParsing(t *testing.T) {
71 - t.Parallel()
72 -
73 - var YAMLTestCases struct {
74 - Cases []struct {
75 - Input string `yaml:"user_agent_string"`
76 - Expected UserAgent `yaml:",inline"`
77 - } `yaml:"test_cases"`
78 - }
79 -
80 - for _, filepath := range []string{"../uap-core/test_resources/pgts_browser_list.yaml", "../uap-core/test_resources/firefox_user_agent_strings.yaml", "../uap-core/tests/test_ua.yaml"} {
81 - unmarshalResourceTestFile(filepath, &YAMLTestCases)
82 -
83 - for _, c := range YAMLTestCases.Cases {
84 - actual := testParser.ParseUserAgent(c.Input)
85 - if got, want := *actual, c.Expected; got != want {
86 - t.Fatalf("got %#v\n want %#v\n", got, want)
87 - }
88 - }
89 - }
90 -}
91 -
92 -func TestDeviceParsing(t *testing.T) {
93 - t.Parallel()
94 -
95 - var YAMLTestCases struct {
96 - Cases []struct {
97 - Input string `yaml:"user_agent_string"`
98 - Expected Device `yaml:",inline"`
99 - } `yaml:"test_cases"`
100 - }
101 -
102 - for _, filepath := range []string{"../uap-core/tests/test_device.yaml"} {
103 - unmarshalResourceTestFile(filepath, &YAMLTestCases)
104 -
105 - for _, c := range YAMLTestCases.Cases {
106 - actual := testParser.ParseDevice(c.Input)
107 - if got, want := *actual, c.Expected; got != want {
108 - t.Fatalf("got %#v\n want %#v\n", got, want)
109 - }
110 - }
111 - }
112 -}
113 -
114 -func TestGenericParseMethodConcurrency(t *testing.T) { // go test -race -run=Concurrency
115 - var YAMLTestCases struct {
116 - Cases []struct {
117 - Input string `yaml:"user_agent_string"`
118 - Expected Os `yaml:",inline"`
119 - } `yaml:"test_cases"`
120 - }
121 -
122 - for _, filepath := range []string{"../uap-core/tests/test_os.yaml"} {
123 - unmarshalResourceTestFile(filepath, &YAMLTestCases)
124 -
125 - for _, c := range YAMLTestCases.Cases {
126 - actual := testParser.Parse(c.Input).Os
127 - if got, want := *actual, c.Expected; got != want {
128 - t.Fatalf("got %#v\n want %#v\n", got, want)
129 - }
130 - }
131 - }
132 -}
133 +//func TestUAParsing(t *testing.T) {
134 +// t.Parallel()
135 +//
136 +// var YAMLTestCases struct {
137 +// Cases []struct {
138 +// Input string `yaml:"user_agent_string"`
139 +// Expected UserAgent `yaml:",inline"`
140 +// } `yaml:"test_cases"`
141 +// }
142 +//
143 +// for _, filepath := range []string{"../uap-core/test_resources/pgts_browser_list.yaml", "../uap-core/test_resources/firefox_user_agent_strings.yaml", "../uap-core/tests/test_ua.yaml"} {
144 +// unmarshalResourceTestFile(filepath, &YAMLTestCases)
145 +//
146 +// for _, c := range YAMLTestCases.Cases {
147 +// actual := testParser.ParseUserAgent(c.Input)
148 +// if got, want := *actual, c.Expected; got != want {
149 +// t.Fatalf("got %#v\n want %#v\n", got, want)
150 +// }
151 +// }
152 +// }
153 +//}
154 +//
155 +//func TestDeviceParsing(t *testing.T) {
156 +// t.Parallel()
157 +//
158 +// var YAMLTestCases struct {
159 +// Cases []struct {
160 +// Input string `yaml:"user_agent_string"`
161 +// Expected Device `yaml:",inline"`
162 +// } `yaml:"test_cases"`
163 +// }
164 +//
165 +// for _, filepath := range []string{"../uap-core/tests/test_device.yaml"} {
166 +// unmarshalResourceTestFile(filepath, &YAMLTestCases)
167 +//
168 +// for _, c := range YAMLTestCases.Cases {
169 +// actual := testParser.ParseDevice(c.Input)
170 +// if got, want := *actual, c.Expected; got != want {
171 +// t.Fatalf("got %#v\n want %#v\n", got, want)
172 +// }
173 +// }
174 +// }
175 +//}
176 +//
177 +//func TestGenericParseMethodConcurrency(t *testing.T) { // go test -race -run=Concurrency
178 +// var YAMLTestCases struct {
179 +// Cases []struct {
180 +// Input string `yaml:"user_agent_string"`
181 +// Expected Os `yaml:",inline"`
182 +// } `yaml:"test_cases"`
183 +// }
184 +//
185 +// for _, filepath := range []string{"../uap-core/tests/test_os.yaml"} {
186 +// unmarshalResourceTestFile(filepath, &YAMLTestCases)
187 +//
188 +// for _, c := range YAMLTestCases.Cases {
189 +// actual := testParser.Parse(c.Input).Os
190 +// if got, want := *actual, c.Expected; got != want {
191 +// t.Fatalf("got %#v\n want %#v\n", got, want)
192 +// }
193 +// }
194 +// }
195 +//}
196
197 func unmarshalResourceTestFile(filepath string, v interface{}) {
198 file, err := ioutil.ReadFile(filepath)
199 Index: golang-github-ua-parser-uap-go/uaparser/benchmark_test.go
200 ===================================================================
201 --- golang-github-ua-parser-uap-go.orig/uaparser/benchmark_test.go 2020-01-12 23:27:25.864207724 +0000
202 +++ golang-github-ua-parser-uap-go/uaparser/benchmark_test.go 2020-01-13 00:20:39.197391939 +0000
203 @@ -1,53 +1,53 @@
204 package uaparser
205
206 -import (
207 - "log"
208 - "testing"
209 -)
210 -
211 -var benchedParser *Parser
212 -var benchedParserWithOptions *Parser
213 -
214 -func init() {
215 - var err error
216 - benchedParser, err = New("../uap-core/regexes.yaml")
217 - if err != nil {
218 - log.Fatal(err)
219 - }
220 - benchedParserWithOptions, err = NewWithOptions("../uap-core/regexes.yaml", (EOsLookUpMode | EUserAgentLookUpMode), 100, 20, true, true)
221 - if err != nil {
222 - log.Fatal(err)
223 - }
224 -}
225 -
226 -func BenchmarkParser(b *testing.B) {
227 - for i := 0; i < b.N; i++ {
228 - for _, ua := range uas {
229 - benchedParser.Parse(ua)
230 - }
231 - }
232 -}
233 -
234 -func BenchmarkParserWithOptions(b *testing.B) {
235 - for i := 0; i < b.N; i++ {
236 - for _, ua := range uas {
237 - benchedParserWithOptions.Parse(ua)
238 - }
239 - }
240 -}
241 -
242 -var uas = []string{
243 - "Mozilla/5.0 (Windows NT 6.0; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre",
244 - "Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
245 - "Mozilla/5.0 (Windows NT 6.0; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre",
246 - "Mozilla/5.0 (Windows NT 5.2; rv:2.1.1) Gecko/ Firefox/5.0.1",
247 - "Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.2.8) Gecko/20100722 Firefox 3.6.8 GTB7.1",
248 - "Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko Firefox/5.0.1",
249 - "Mozilla/5.0 (Android; Linux armv7l; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre Fennec/2.0b1pre",
250 - "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100408 Thunderbird/3.0.3",
251 - "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 SeaMonkey/2.1.1",
252 - "ACS-NF 3.0 ACS-NF/3.0 NEC-c616/001.00",
253 - "BlackBerry7730 3.7.1 BlackBerry7730/3.7.1 UP.Link/5.1.2.5",
254 - "Galeon 1.3.18 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 Galeon/1.3.18",
255 - "Opera/9.80 (J2ME/MIDP; Opera Mini/7.1.32052/35.5706; U; id) Presto/2.8.119 Version/11.10",
256 -}
257 +//import (
258 +// "log"
259 +// "testing"
260 +//)
261 +
262 +//var benchedParser *Parser
263 +//var benchedParserWithOptions *Parser
264 +
265 +//func init() {
266 +// var err error
267 +// benchedParser, err = New("../uap-core/regexes.yaml")
268 +// if err != nil {
269 +// log.Fatal(err)
270 +// }
271 +// benchedParserWithOptions, err = NewWithOptions("../uap-core/regexes.yaml", (EOsLookUpMode | EUserAgentLookUpMode), 100, 20, true, true)
272 +// if err != nil {
273 +// log.Fatal(err)
274 +// }
275 +//}
276 +//
277 +//func BenchmarkParser(b *testing.B) {
278 +// for i := 0; i < b.N; i++ {
279 +// for _, ua := range uas {
280 +// benchedParser.Parse(ua)
281 +// }
282 +// }
283 +//}
284 +//
285 +//func BenchmarkParserWithOptions(b *testing.B) {
286 +// for i := 0; i < b.N; i++ {
287 +// for _, ua := range uas {
288 +// benchedParserWithOptions.Parse(ua)
289 +// }
290 +// }
291 +//}
292 +//
293 +//var uas = []string{
294 +// "Mozilla/5.0 (Windows NT 6.0; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre",
295 +// "Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko/20100101 Firefox/4.0.1",
296 +// "Mozilla/5.0 (Windows NT 6.0; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre",
297 +// "Mozilla/5.0 (Windows NT 5.2; rv:2.1.1) Gecko/ Firefox/5.0.1",
298 +// "Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.2.8) Gecko/20100722 Firefox 3.6.8 GTB7.1",
299 +// "Mozilla/5.0 (Windows NT 5.2; rv:2.0.1) Gecko Firefox/5.0.1",
300 +// "Mozilla/5.0 (Android; Linux armv7l; rv:2.0b6pre) Gecko/20100907 Firefox/4.0b6pre Fennec/2.0b1pre",
301 +// "Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100408 Thunderbird/3.0.3",
302 +// "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0.1) Gecko/20100101 Firefox/4.0.1 SeaMonkey/2.1.1",
303 +// "ACS-NF 3.0 ACS-NF/3.0 NEC-c616/001.00",
304 +// "BlackBerry7730 3.7.1 BlackBerry7730/3.7.1 UP.Link/5.1.2.5",
305 +// "Galeon 1.3.18 Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041020 Galeon/1.3.18",
306 +// "Opera/9.80 (J2ME/MIDP; Opera Mini/7.1.32052/35.5706; U; id) Presto/2.8.119 Version/11.10",
307 +//}