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[] = [
136
136
'/:"test"stuff' ,
137
137
) ,
138
138
} ,
139
+ {
140
+ path : "\\\\:test" ,
141
+ expected : new TokenData (
142
+ [
143
+ { type : "text" , value : "\\" } ,
144
+ { type : "param" , name : "test" } ,
145
+ ] ,
146
+ "\\\\:test" ,
147
+ ) ,
148
+ } ,
139
149
] ;
140
150
141
151
export const STRINGIFY_TESTS : StringifyTestSet [ ] = [
@@ -204,6 +214,13 @@ export const STRINGIFY_TESTS: StringifyTestSet[] = [
204
214
] ) ,
205
215
expected : '/:"test"stuff' ,
206
216
} ,
217
+ {
218
+ data : new TokenData ( [
219
+ { type : "text" , value : "\\" } ,
220
+ { type : "param" , name : "test" } ,
221
+ ] ) ,
222
+ expected : "\\\\:test" ,
223
+ } ,
207
224
] ;
208
225
209
226
export const COMPILE_TESTS : CompileTestSet [ ] = [
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ const SIMPLE_TOKENS: Record<string, TokenType> = {
102
102
* Escape text for stringify to path.
103
103
*/
104
104
function escapeText ( str : string ) {
105
- return str . replace ( / [ { } ( ) \[ \] + ? ! : * ] / g, "\\$&" ) ;
105
+ return str . replace ( / [ { } ( ) \[ \] + ? ! : * \\ ] / g, "\\$&" ) ;
106
106
}
107
107
108
108
/**
You can’t perform that action at this time.
0 commit comments