@@ -46,7 +46,7 @@ describe("UrlMatch-google-error", () => {
4646} ) ;
4747
4848// 从tm找的一些特殊的匹配规则
49- describe ( "UrlMatch-search " , ( ) => {
49+ describe ( "UrlMatch-special " , ( ) => {
5050 const url = new UrlMatch < string > ( ) ;
5151 url . add ( "https://www.google.com/search?q=*" , "ok1" ) ;
5252 it ( "match1" , ( ) => {
@@ -88,6 +88,14 @@ describe("UrlMatch-search", () => {
8888 expect ( url . match ( "http://www.example.com" ) ) . toEqual ( [ "ok1" ] ) ;
8989 expect ( url . match ( "https://www.example.com" ) ) . toEqual ( [ "ok1" ] ) ;
9090 } ) ;
91+ it ( "/^.*?://.*?.example.com.*?$/" , ( ) => {
92+ const url = new UrlMatch < string > ( ) ;
93+ url . add ( "/^.*?://.*?.example.com.*?$/" , "ok1" ) ;
94+ expect ( url . match ( "https://www.example.com" ) ) . toEqual ( [ "ok1" ] ) ;
95+ expect ( url . match ( "http://www.example.com" ) ) . toEqual ( [ "ok1" ] ) ;
96+ expect ( url . match ( "https://api.example.com/foo/bar" ) ) . toEqual ( [ "ok1" ] ) ;
97+ expect ( url . match ( "https://api.foo.example.com/foo/bar" ) ) . toEqual ( [ "ok1" ] ) ;
98+ } ) ;
9199} ) ;
92100
93101describe ( "UrlMatch-port1" , ( ) => {
@@ -148,6 +156,7 @@ describe("dealPatternMatches", () => {
148156 "*://*example.com/*" ,
149157 "*.example.com/path/*" ,
150158 "http*" ,
159+ "/^.*?://.*?.example.com.*?$/" ,
151160 ] ) ;
152161 expect ( matches . patternResult ) . toEqual ( [
153162 "*://*/*" ,
@@ -156,6 +165,7 @@ describe("dealPatternMatches", () => {
156165 "*://example.com/*" ,
157166 "*://*.example.com/path/*" ,
158167 "*://*/*" ,
168+ "*://*/*" ,
159169 ] ) ;
160170 expect ( matches . result ) . toEqual ( [
161171 "*://www.example.com*" ,
@@ -164,6 +174,7 @@ describe("dealPatternMatches", () => {
164174 "*://*example.com/*" ,
165175 "*.example.com/path/*" ,
166176 "http*" ,
177+ "/^.*?://.*?.example.com.*?$/" ,
167178 ] ) ;
168179 } ) ;
169180 it ( "特殊情况-exclude" , ( ) => {
0 commit comments