ua-parser / uap-core

The regex file necessary to build language ports of Browserscope's user agent parser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Broken test case(s) when implementing `patch_minor` in user agent parser?

masklinn opened this issue · comments

It might be an error in my implementation, but when trying to add patch_minor to the "user agent" parser I'm getting mismatches: test_ua has the following case:

uap-core/tests/test_ua.yaml

Lines 1478 to 1483 in d668d6c

- user_agent_string: 'Mozilla/5.0 (Series40; NokiaC3-01/05.60; Profile/MIDP-2.1 Configuration/CLDC-1.1) Gecko/20100401 S40OviBrowser/2.2.0.0.31'
family: 'Ovi Browser'
major: '2'
minor: '2'
patch: '0'
patch_minor:

as far as I can tell this should match the following rule:

uap-core/regexes.yaml

Lines 850 to 851 in d668d6c

- regex: '(S40OviBrowser)/(\d+)\.(\d+)\.(\d+)\.(\d+)'
family_replacement: 'Ovi Browser'

but the rule has 5 groups, so it is capturing patch_minor: '0' not null is it not?

And the reverse issue,

uap-core/tests/test_ua.yaml

Lines 6754 to 6759 in d668d6c

- user_agent_string: 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77 [FBAN/FBIOS;FBAV/194.0.0.38.99;FBBV/127868476;FBDV/iPhone7,2;FBMD/iPhone;FBSN/iOS;FBSV/11.4.1;FBSS/2;FBCR/OrangeBotswana;FBID/phone;FBLC/en_GB;FBOP/5;FBRV/128807018]'
family: 'Facebook'
major: '194'
minor: '0'
patch: '0'
patch_minor: '38'

should match

uap-core/regexes.yaml

Lines 176 to 177 in d668d6c

- regex: '\[FB.{0,300};(FBAV)/(\d+)(?:\.(\d+)|)(?:\.(\d+)|)'
family_replacement: 'Facebook'

but the regex only has 4 groups including the family, so there should be no capture of the patch_minor.

resolved by #579