Skip to content

Commit 47f7ff1

Browse files
author
Gilad Naaman
committed
libtest: JSON fixes
1 parent 49b00f6 commit 47f7ff1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/libtest/formatters.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -330,14 +330,14 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
330330

331331
fn write_run_finish(&mut self, state: &ConsoleTestState) -> io::Result<bool> {
332332

333-
self.write_str(&*format!(r#"{{ "type": "suite",
334-
"event": "{}",
335-
"passed": {},
336-
"failed": {},
337-
"allowed_fail": {},
338-
"ignored": {},
339-
"measured": {},
340-
"filtered_out": "{}" }}"#,
333+
self.write_str(&*format!("{{ \"type\": \"suite\",\
334+
\"event\": \"{}\", \
335+
\"passed\": {}, \
336+
\"failed\": {}, \
337+
\"allowed_fail\": {}, \
338+
\"ignored\": {}, \
339+
\"measured\": {}, \
340+
\"filtered_out\": \"{}\" }}",
341341
if state.failed == 0 { "ok" } else { "failed" },
342342
state.passed,
343343
state.failed + state.allowed_fail,
@@ -351,7 +351,7 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
351351
let output = naive_json_escape(&*String::from_utf8_lossy(stdout));
352352

353353
self.write_str(
354-
&*format!(r#"{{ "type": "test_output", "name": "{}" "output": "{}" }}"#,
354+
&*format!(r#"{{ "type": "test_output", "name": "{}", "output": "{}" }}"#,
355355
f.name,
356356
output))?;
357357
}

0 commit comments

Comments
 (0)