| 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 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 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 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
|
| 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 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 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 |
+//} |