1
Fork 0

Auto merge of #53867 - cwndrws:json-test-formatter-test-count-as-num, r=nrc

Make json test output formatter represent "test_count" as num

fixes #53866
This commit is contained in:
bors 2018-09-05 09:57:56 +00:00
commit b0297f3043
2 changed files with 4 additions and 4 deletions

View file

@ -50,7 +50,7 @@ impl<T: Write> JsonFormatter<T> {
impl<T: Write> OutputFormatter for JsonFormatter<T> { impl<T: Write> OutputFormatter for JsonFormatter<T> {
fn write_run_start(&mut self, test_count: usize) -> io::Result<()> { fn write_run_start(&mut self, test_count: usize) -> io::Result<()> {
self.write_message(&*format!( self.write_message(&*format!(
r#"{{ "type": "suite", "event": "started", "test_count": "{}" }}"#, r#"{{ "type": "suite", "event": "started", "test_count": {} }}"#,
test_count test_count
)) ))
} }
@ -136,7 +136,7 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
\"allowed_fail\": {}, \ \"allowed_fail\": {}, \
\"ignored\": {}, \ \"ignored\": {}, \
\"measured\": {}, \ \"measured\": {}, \
\"filtered_out\": \"{}\" }}", \"filtered_out\": {} }}",
if state.failed == 0 { "ok" } else { "failed" }, if state.failed == 0 { "ok" } else { "failed" },
state.passed, state.passed,
state.failed + state.allowed_fail, state.failed + state.allowed_fail,

View file

@ -1,4 +1,4 @@
{ "type": "suite", "event": "started", "test_count": "4" } { "type": "suite", "event": "started", "test_count": 4 }
{ "type": "test", "event": "started", "name": "a" } { "type": "test", "event": "started", "name": "a" }
{ "type": "test", "name": "a", "event": "ok" } { "type": "test", "name": "a", "event": "ok" }
{ "type": "test", "event": "started", "name": "b" } { "type": "test", "event": "started", "name": "b" }
@ -7,4 +7,4 @@
{ "type": "test", "name": "c", "event": "ok" } { "type": "test", "name": "c", "event": "ok" }
{ "type": "test", "event": "started", "name": "d" } { "type": "test", "event": "started", "name": "d" }
{ "type": "test", "name": "d", "event": "ignored" } { "type": "test", "name": "d", "event": "ignored" }
{ "type": "suite", "event": "failed", "passed": 2, "failed": 1, "allowed_fail": 0, "ignored": 1, "measured": 0, "filtered_out": "0" } { "type": "suite", "event": "failed", "passed": 2, "failed": 1, "allowed_fail": 0, "ignored": 1, "measured": 0, "filtered_out": 0 }