@@ -334,6 +334,31 @@ no_triple_quote_string_when_oneliner_test_() ->
334
334
? _assertEqual ([<<" root {a = \" a\\ nb\" }" >>], hocon_pp :do (Value , #{newline => <<>>}))
335
335
].
336
336
337
+ % % Tests that having an one liner with characters that should be escaped do not interfere
338
+ % % badly with other values which are triple quoted with indentation.
339
+ % %
340
+ % % At the time of writing, the below example does not trigger the original bug if only
341
+ % % root2 is present and expected. Also, if the trailing backslash in root1 is removed, it
342
+ % % also does not trigger the bug.
343
+ triple_quote_string_ending_in_backslash_test () ->
344
+ Raw = #{
345
+ <<" root1" >> => #{<<" x" >> => <<" \t\"\\\"\\ t\\ " >>},
346
+ <<" root2" >> => #{<<" x" >> => <<" select \n from\n \" hello\" " >>}
347
+ },
348
+ Sc = #{
349
+ roots => [root1 , root2 ],
350
+ fields => #{
351
+ root1 => [{" x" , hoconsc :mk (binary ())}],
352
+ root2 => [{" x" , hoconsc :mk (binary ())}]
353
+ }
354
+ },
355
+ % % Parses fine.
356
+ Raw = hocon_tconf :check_plain (Sc , Raw , #{}),
357
+ PP = hocon_pp :do (Raw , #{}),
358
+ % % Roundtrip: must read back the same thing.
359
+ ? assertEqual ({ok , Raw }, hocon :binary (PP )),
360
+ ok .
361
+
337
362
crlf_multiline_test_ () ->
338
363
Value = #{<<" root" >> => #{<<" x" >> => <<" \r\n\r\n a\r\n b\n " >>}},
339
364
CRLF = <<" \r\n " >>,
0 commit comments