File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,16 @@ export const PARSER_TESTS: ParserTestSet[] = [
136136 '/:"test"stuff' ,
137137 ) ,
138138 } ,
139+ {
140+ path : "\\\\:test" ,
141+ expected : new TokenData (
142+ [
143+ { type : "text" , value : "\\" } ,
144+ { type : "param" , name : "test" } ,
145+ ] ,
146+ "\\\\:test" ,
147+ ) ,
148+ } ,
139149] ;
140150
141151export const STRINGIFY_TESTS : StringifyTestSet [ ] = [
@@ -204,6 +214,13 @@ export const STRINGIFY_TESTS: StringifyTestSet[] = [
204214 ] ) ,
205215 expected : '/:"test"stuff' ,
206216 } ,
217+ {
218+ data : new TokenData ( [
219+ { type : "text" , value : "\\" } ,
220+ { type : "param" , name : "test" } ,
221+ ] ) ,
222+ expected : "\\\\:test" ,
223+ } ,
207224] ;
208225
209226export const COMPILE_TESTS : CompileTestSet [ ] = [
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ const SIMPLE_TOKENS: Record<string, TokenType> = {
102102 * Escape text for stringify to path.
103103 */
104104function escapeText ( str : string ) {
105- return str . replace ( / [ { } ( ) \[ \] + ? ! : * ] / g, "\\$&" ) ;
105+ return str . replace ( / [ { } ( ) \[ \] + ? ! : * \\ ] / g, "\\$&" ) ;
106106}
107107
108108/**
You can’t perform that action at this time.
0 commit comments