MCPcopy Create free account
hub / github.com/dprint/jsonc-parser / new_escaped_in_array_values

Function new_escaped_in_array_values

src/cst/mod.rs:4368–4383  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4366
4367 #[test]
4368 fn new_escaped_in_array_values() {
4369 let cst = build_cst(r#"{"items": []}"#);
4370 let root_obj = cst.object_value().unwrap();
4371 let arr = root_obj.array_value("items").unwrap();
4372
4373 arr.append(json!("path\\to\\file"));
4374 arr.append(json!("line1\nline2"));
4375
4376 let text = cst.to_string();
4377 assert!(
4378 text.contains(r#""path\\to\\file""#),
4379 "backslash in array element: {}",
4380 text
4381 );
4382 assert!(text.contains(r#""line1\nline2""#), "newline in array element: {}", text);
4383 }
4384
4385 #[test]
4386 fn new_escaped_property_name_with_special_chars() {

Callers

nothing calls this directly

Calls 4

build_cstFunction · 0.85
object_valueMethod · 0.80
array_valueMethod · 0.80
appendMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…