()
| 2117 | |
| 2118 | #[test] |
| 2119 | fn strict_load_errors_on_invalid_json() { |
| 2120 | let dir = tmpdir(); |
| 2121 | let path = dir.path().join("bad.json"); |
| 2122 | fs::write(&path, "not json {{{").unwrap(); |
| 2123 | let err = load_json_file_strict(&path).unwrap_err(); |
| 2124 | let msg = err.to_string(); |
| 2125 | assert!(msg.contains("cannot parse"), "error: {msg}"); |
| 2126 | assert!( |
| 2127 | msg.contains("bad.json"), |
| 2128 | "error should mention filename: {msg}" |
| 2129 | ); |
| 2130 | } |
| 2131 | |
| 2132 | #[test] |
| 2133 | fn strict_load_errors_on_truncated_json() { |
nothing calls this directly
no test coverage detected