File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,9 @@ let language_tag_invalid_char lang_tag : char -> Loc.span -> Warning.t =
88
88
let code_block_tag_invalid_char : char -> Loc.span -> Warning.t =
89
89
Warning. make " Invalid character in code block metadata tag '%c'."
90
90
91
+ let invalid_char_code : int -> Loc.span -> Warning.t =
92
+ Warning. make " Invalid escape sequence '\\ %d"
93
+
91
94
let truncated_code_block_meta : Loc.span -> Warning.t =
92
95
Warning. make ~suggestion: " try '{@ocaml[ ... ]}'." " Missing end of code block."
93
96
Original file line number Diff line number Diff line change @@ -3230,6 +3230,48 @@ let%expect_test _ =
3230
3230
(warnings ()))
3231
3231
|}]
3232
3232
3233
+ let empty_key =
3234
+ test "{@ocaml =foo [ code ]}";
3235
+ [%expect
3236
+ {|
3237
+ ((output
3238
+ (((f.ml (1 0) (1 22))
3239
+ (code_block (((f.ml (1 2) (1 7)) ocaml) ())
3240
+ ((f.ml (1 14) (1 20)) " code ")))))
3241
+ (warnings
3242
+ ( "File \"f.ml\", line 1, characters 8-9:\
3243
+ \nInvalid character in code block metadata tag '='."
3244
+ "File \"f.ml\", line 1, characters 9-14:\
3245
+ \nInvalid character in code block metadata tag 'f'.")))
3246
+ |}]
3247
+
3248
+ let no_escape_without_quotes =
3249
+ test {|{@ocaml \n\t\b=hello [ code ]}|};
3250
+ [%expect
3251
+ {|
3252
+ ((output
3253
+ (((f.ml (1 0) (1 30))
3254
+ (code_block
3255
+ (((f.ml (1 2) (1 7)) ocaml)
3256
+ ((binding ((f.ml (1 8) (1 14)) "\\n\\t\\b")
3257
+ ((f.ml (1 15) (1 20)) hello))))
3258
+ ((f.ml (1 22) (1 28)) " code ")))))
3259
+ (warnings ()))
3260
+ |}]
3261
+
3262
+ let escape_within_quotes =
3263
+ test {|{@ocaml "\065"=hello [ code ]}|};
3264
+ [%expect
3265
+ {|
3266
+ ((output
3267
+ (((f.ml (1 0) (1 30))
3268
+ (code_block
3269
+ (((f.ml (1 2) (1 7)) ocaml)
3270
+ ((binding ((f.ml (1 9) (1 13)) A) ((f.ml (1 15) (1 20)) hello))))
3271
+ ((f.ml (1 22) (1 28)) " code ")))))
3272
+ (warnings ()))
3273
+ |}]
3274
+
3233
3275
let langtag_non_word =
3234
3276
test "{@ocaml,top[ code ]}";
3235
3277
[%expect
You can’t perform that action at this time.
0 commit comments