()
| 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() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…