Skip to content

Commit

Permalink
Support v1.10 spec (#16)
Browse files Browse the repository at this point in the history
* ignore woothee directory, fetched to update _test.go

* fetch/update woothee spec to v1.10

* fix bug to generate test code to check undefined test result as UNKNOWN

* regenerate tests

* support Android 9

* support Chrominum Edge and Edge for iOS/Android
  • Loading branch information
tagomoris authored and hhatto committed Apr 15, 2019
1 parent e870e34 commit 5a19241
Show file tree
Hide file tree
Showing 20 changed files with 871 additions and 788 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ _cgo_export.*
_testmain.go

*.exe

# spec project fetched to update _test.go
woothee/
95 changes: 45 additions & 50 deletions appliance_test.go

Large diffs are not rendered by default.

52 changes: 16 additions & 36 deletions blank_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ func Test_blank(t *testing.T) {
if result.Name != "UNKNOWN" {
t.Errorf("Expected result.Name for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if true && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", ``, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if true && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Version)
}
}
Expand All @@ -38,54 +38,34 @@ func Test_blank(t *testing.T) {
if result.Name != "UNKNOWN" {
t.Errorf("Expected result.Name for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if true && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", ``, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if true && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Version)
}
}
result, err = Parse(``)
if err != nil {
t.Errorf(`Failed to parse '': %s`, err)
} else {
if result.Category != "UNKNOWN" {
t.Errorf("Expected result.Category for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Category)
}
if result.Name != "UNKNOWN" {
t.Errorf("Expected result.Name for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Name)
}
if result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Os)
}
if result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", ``, result.OsVersion)
}
if result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Version)
}
}
result, err = Parse(``)
result, err = Parse(`-`)
if err != nil {
t.Errorf(`Failed to parse '': %s`, err)
t.Errorf(`Failed to parse '-': %s`, err)
} else {
if result.Category != "UNKNOWN" {
t.Errorf("Expected result.Category for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Category)
t.Errorf("Expected result.Category for '%s' to be 'UNKNOWN', but got '%s'", `-`, result.Category)
}
if result.Name != "UNKNOWN" {
t.Errorf("Expected result.Name for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Name)
t.Errorf("Expected result.Name for '%s' to be 'UNKNOWN', but got '%s'", `-`, result.Name)
}
if result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Os)
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", `-`, result.Os)
}
if result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", ``, result.OsVersion)
if true && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `-`, result.OsVersion)
}
if result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", ``, result.Version)
if true && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `-`, result.Version)
}
}

Expand Down
60 changes: 30 additions & 30 deletions crawler_google_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ func Test_crawler_google(t *testing.T) {
if result.Name != "Googlebot" {
t.Errorf("Expected result.Name for '%s' to be 'Googlebot', but got '%s'", `Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)`, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)`, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)`, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)`, result.Version)
}
}
Expand All @@ -38,13 +38,13 @@ func Test_crawler_google(t *testing.T) {
if result.Name != "Googlebot" {
t.Errorf("Expected result.Name for '%s' to be 'Googlebot', but got '%s'", `Googlebot-Image/1.0`, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", `Googlebot-Image/1.0`, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Googlebot-Image/1.0`, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Googlebot-Image/1.0`, result.Version)
}
}
Expand All @@ -58,13 +58,13 @@ func Test_crawler_google(t *testing.T) {
if result.Name != "Googlebot Mobile" {
t.Errorf("Expected result.Name for '%s' to be 'Googlebot Mobile', but got '%s'", `DoCoMo/2.0 N905i(c100;TB;W24H16) (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)`, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", `DoCoMo/2.0 N905i(c100;TB;W24H16) (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)`, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `DoCoMo/2.0 N905i(c100;TB;W24H16) (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)`, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `DoCoMo/2.0 N905i(c100;TB;W24H16) (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)`, result.Version)
}
}
Expand All @@ -78,13 +78,13 @@ func Test_crawler_google(t *testing.T) {
if result.Name != "Googlebot Mobile" {
t.Errorf("Expected result.Name for '%s' to be 'Googlebot Mobile', but got '%s'", `SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)`, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", `SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)`, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)`, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `SAMSUNG-SGH-E250/1.0 Profile/MIDP-2.0 Configuration/CLDC-1.1 UP.Browser/6.2.3.3.c.1.101 (GUI) MMP/2.0 (compatible; Googlebot-Mobile/2.1; +http://www.google.com/bot.html)`, result.Version)
}
}
Expand All @@ -98,13 +98,13 @@ func Test_crawler_google(t *testing.T) {
if result.Name != "Google Mediapartners" {
t.Errorf("Expected result.Name for '%s' to be 'Google Mediapartners', but got '%s'", `DoCoMo/2.0 SH905i(c100;TB;W24H16) (compatible; Mediapartners-Google/2.1; +http://www.google.com/bot.html)`, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", `DoCoMo/2.0 SH905i(c100;TB;W24H16) (compatible; Mediapartners-Google/2.1; +http://www.google.com/bot.html)`, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `DoCoMo/2.0 SH905i(c100;TB;W24H16) (compatible; Mediapartners-Google/2.1; +http://www.google.com/bot.html)`, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `DoCoMo/2.0 SH905i(c100;TB;W24H16) (compatible; Mediapartners-Google/2.1; +http://www.google.com/bot.html)`, result.Version)
}
}
Expand All @@ -118,13 +118,13 @@ func Test_crawler_google(t *testing.T) {
if result.Name != "Google Mediapartners" {
t.Errorf("Expected result.Name for '%s' to be 'Google Mediapartners', but got '%s'", `Mediapartners-Google`, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", `Mediapartners-Google`, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mediapartners-Google`, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Mediapartners-Google`, result.Version)
}
}
Expand All @@ -138,13 +138,13 @@ func Test_crawler_google(t *testing.T) {
if result.Name != "Google Feedfetcher" {
t.Errorf("Expected result.Name for '%s' to be 'Google Feedfetcher', but got '%s'", `Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; feed-id=000000000000000000)`, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", `Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; feed-id=000000000000000000)`, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; feed-id=000000000000000000)`, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Feedfetcher-Google; (+http://www.google.com/feedfetcher.html; feed-id=000000000000000000)`, result.Version)
}
}
Expand All @@ -158,13 +158,13 @@ func Test_crawler_google(t *testing.T) {
if result.Name != "Google AppEngine" {
t.Errorf("Expected result.Name for '%s' to be 'Google AppEngine', but got '%s'", `AppEngine-Google`, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", `AppEngine-Google`, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `AppEngine-Google`, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `AppEngine-Google`, result.Version)
}
}
Expand All @@ -178,13 +178,13 @@ func Test_crawler_google(t *testing.T) {
if result.Name != "Google Web Preview" {
t.Errorf("Expected result.Name for '%s' to be 'Google Web Preview', but got '%s'", `Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13`, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13`, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13`, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13`, result.Version)
}
}
Expand All @@ -198,13 +198,13 @@ func Test_crawler_google(t *testing.T) {
if result.Name != "Google FeedBurner" {
t.Errorf("Expected result.Name for '%s' to be 'Google FeedBurner', but got '%s'", `FeedBurner/1.0 (http://www.FeedBurner.com)`, result.Name)
}
if result.Os != "UNKNOWN" {
if true && result.Os != "UNKNOWN" {
t.Errorf("Expected result.Os for '%s' to be 'UNKNOWN', but got '%s'", `FeedBurner/1.0 (http://www.FeedBurner.com)`, result.Os)
}
if result.OsVersion != "UNKNOWN" {
if false && result.OsVersion != "UNKNOWN" {
t.Errorf("Expected result.OsVersion for '%s' to be 'UNKNOWN', but got '%s'", `FeedBurner/1.0 (http://www.FeedBurner.com)`, result.OsVersion)
}
if result.Version != "UNKNOWN" {
if false && result.Version != "UNKNOWN" {
t.Errorf("Expected result.Version for '%s' to be 'UNKNOWN', but got '%s'", `FeedBurner/1.0 (http://www.FeedBurner.com)`, result.Version)
}
}
Expand Down
Loading

0 comments on commit 5a19241

Please sign in to comment.