File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed
Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ interface CommentObject {
2525
2626const COMMENT_RE = / \* \/ / g;
2727export const LB_RE = / \r ? \n / g;
28- export const DOUBLE_QUOTE_RE = / " / g;
28+ export const DOUBLE_QUOTE_RE = / (?< ! \\ ) " / g;
2929const ESC_0_RE = / ~ 0 / g;
3030const ESC_1_RE = / ~ 1 / g;
3131const TILDE_RE = / ~ / g;
Original file line number Diff line number Diff line change 1- import { tsIntersectionOf , tsUnionOf } from "../src/utils.js" ;
1+ import { parseRef , tsIntersectionOf , tsUnionOf } from "../src/utils.js" ;
22
33describe ( "utils" , ( ) => {
44 describe ( "tsUnionOf" , ( ) => {
@@ -61,4 +61,22 @@ describe("utils", () => {
6161 } ) ;
6262 } ) ;
6363 } ) ;
64- } ) ;
64+
65+ describe ( "parseRef" , ( ) => {
66+ it ( "basic" , ( ) => {
67+ expect ( parseRef ( "#/test/schema-object" ) ) . toStrictEqual ( { filename : "." , path : [ "test" , "schema-object" ] } ) ;
68+ } ) ;
69+
70+ it ( "double quote" , ( ) => {
71+ expect ( parseRef ( "#/test/\"" ) ) . toStrictEqual ( { filename : "." , path : [ "test" , '\\\"' ] } ) ;
72+ } ) ;
73+
74+ it ( "escaped double quote" , ( ) => {
75+ expect ( parseRef ( "#/test/\\\"" ) ) . toStrictEqual ( { filename : "." , path : [ "test" , '\\\"' ] } ) ;
76+ } ) ;
77+
78+ it ( "tilde escapes" , ( ) => {
79+ expect ( parseRef ( "#/test/~1~0" ) ) . toStrictEqual ( { filename : "." , path : [ "test" , "/~" ] } ) ;
80+ } ) ;
81+ } ) ;
82+ } ) ;
You can’t perform that action at this time.
0 commit comments