()
| 3947 | |
| 3948 | #[test] |
| 3949 | fn or_create_methods() { |
| 3950 | let cst = build_cst(""); |
| 3951 | let obj = cst.object_value_or_create().unwrap(); |
| 3952 | assert_eq!(cst.to_string(), "{}\n"); |
| 3953 | assert!(cst.array_value_or_create().is_none()); |
| 3954 | assert_eq!(obj.object_value_or_create("prop").unwrap().to_string(), "{}"); |
| 3955 | assert!(obj.array_value_or_create("prop").is_none()); |
| 3956 | assert_eq!(obj.array_value_or_create("prop2").unwrap().to_string(), "[]"); |
| 3957 | assert_eq!( |
| 3958 | cst.to_string(), |
| 3959 | r#"{ |
| 3960 | "prop": {}, |
| 3961 | "prop2": [] |
| 3962 | } |
| 3963 | "# |
| 3964 | ); |
| 3965 | } |
| 3966 | |
| 3967 | #[test] |
| 3968 | fn or_set_methods() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…