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 {
25
25
26
26
const COMMENT_RE = / \* \/ / g;
27
27
export const LB_RE = / \r ? \n / g;
28
- export const DOUBLE_QUOTE_RE = / " / g;
28
+ export const DOUBLE_QUOTE_RE = / (?< ! \\ ) " / g;
29
29
const ESC_0_RE = / ~ 0 / g;
30
30
const ESC_1_RE = / ~ 1 / g;
31
31
const 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" ;
2
2
3
3
describe ( "utils" , ( ) => {
4
4
describe ( "tsUnionOf" , ( ) => {
@@ -61,4 +61,22 @@ describe("utils", () => {
61
61
} ) ;
62
62
} ) ;
63
63
} ) ;
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