Skip to content

Commit a8bfac1

Browse files
committed
add more regepx tests
1 parent a0642bc commit a8bfac1

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

test/converter.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ describe('converter', () => {
8181
String.raw`/example\d+\.com/##.banner`,
8282
String.raw`/^[a-z0-9]{5,}\.(?=.*[a-z])(?=.*[0-9])[a-z0-9]{17,}\.(cfd|sbs|shop)$/#$?#*:contains(/(test1|test2)77/i) { scrollbar-width: thin!important; }`,
8383
String.raw`[$path=/id]/^[a-z0-9]{5,}\.(?=.*[a-z])(?=.*[0-9])[a-z0-9]{17,}\.(cfd|sbs|shop)$/#?#body:contains(/(test1|test2)77/i) div:matches-css(position: fixed):has(> img)`,
84+
// regex domains with commas in quantifiers and alternations
85+
String.raw`/example\d{1,}\.com/##.ad`,
86+
String.raw`/example\d{1,}\.(com|org)/##.ad`,
87+
String.raw`/^[a-z0-9]{5,}\.(?=.*[a-z])(?=.*[0-9])[a-z0-9]{17,}\.(cfd|sbs|shop)$/##.ad`,
88+
String.raw`/example\d{1,}\.com/,example.net##.ad`,
89+
String.raw`[$domain=/example\d{1,}\.(com|org)/]##.ad`,
8490
])('converts rule %s', (rule) => {
8591
const convertedRules = convertRulesToAdgSyntax([rule]);
8692

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0.0.3",
3-
"timeUpdated": 1763515095723,
2+
"version": "1.0.0.5",
3+
"timeUpdated": 1763533512231,
44
"hash": "w43ChcOxWR0Iw5J4wrjCjF/DjyvCuhfDpg=="
55
}

test/validator.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,12 @@ describe('validator', () => {
141141
String.raw`/example\d+\.com/##.banner`,
142142
String.raw`/example\d+\.com/##div[class="ad"]`,
143143
String.raw`/^example[0-9]+\.com$/##.advertisement`,
144+
// regex domains with commas in quantifiers and alternations
145+
String.raw`/example\d{1,}\.com/##.ad`,
146+
String.raw`/example\d{1,}\.(com|org)/##.ad`,
147+
String.raw`/^[a-z0-9]{5,}\.(?=.*[a-z])(?=.*[0-9])[a-z0-9]{17,}\.(cfd|sbs|shop)$/##.ad`,
148+
String.raw`/example\d{1,}\.com/,example.net##.ad`,
149+
String.raw`[$domain=/example\d{1,}\.(com|org)/]##.ad`,
144150
];
145151
test.each(validRules)('%s', (rule) => {
146152
const invalid = [];

0 commit comments

Comments
 (0)