Skip to content

Commit

Permalink
Rollup merge of rust-lang#49235 - topecongiro:run-rustfmt/libtest, r=nrc
Browse files Browse the repository at this point in the history
Cargo fmt libtest

r? @nrc

Using `rustfmt 0.4.1- (87180d9 2018-03-16)` (`rustfmt --version` is a bit broken).
  • Loading branch information
frewsxcv authored Mar 23, 2018
2 parents e0274d6 + 75dcc61 commit 003a135
Show file tree
Hide file tree
Showing 5 changed files with 182 additions and 233 deletions.
49 changes: 19 additions & 30 deletions src/libtest/formatters/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,12 @@ impl<T: Write> JsonFormatter<T> {
if let Some(extras) = extra {
self.write_message(&*format!(
r#"{{ "type": "{}", "name": "{}", "event": "{}", {} }}"#,
ty,
name,
evt,
extras
ty, name, evt, extras
))
} else {
self.write_message(&*format!(
r#"{{ "type": "{}", "name": "{}", "event": "{}" }}"#,
ty,
name,
evt
ty, name, evt
))
}
}
Expand Down Expand Up @@ -89,14 +84,12 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
self.write_event("test", desc.name.as_slice(), "failed", extra_data)
}

TrFailedMsg(ref m) => {
self.write_event(
"test",
desc.name.as_slice(),
"failed",
Some(format!(r#""message": "{}""#, EscapedString(m))),
)
}
TrFailedMsg(ref m) => self.write_event(
"test",
desc.name.as_slice(),
"failed",
Some(format!(r#""message": "{}""#, EscapedString(m))),
),

TrIgnored => self.write_event("test", desc.name.as_slice(), "ignored", None),

Expand All @@ -116,13 +109,10 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {

let line = format!(
"{{ \"type\": \"bench\", \
\"name\": \"{}\", \
\"median\": {}, \
\"deviation\": {}{} }}",
desc.name,
median,
deviation,
mbps
\"name\": \"{}\", \
\"median\": {}, \
\"deviation\": {}{} }}",
desc.name, median, deviation, mbps
);

self.write_message(&*line)
Expand All @@ -138,16 +128,15 @@ impl<T: Write> OutputFormatter for JsonFormatter<T> {
}

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

self.write_message(&*format!(
"{{ \"type\": \"suite\", \
\"event\": \"{}\", \
\"passed\": {}, \
\"failed\": {}, \
\"allowed_fail\": {}, \
\"ignored\": {}, \
\"measured\": {}, \
\"filtered_out\": \"{}\" }}",
\"event\": \"{}\", \
\"passed\": {}, \
\"failed\": {}, \
\"allowed_fail\": {}, \
\"ignored\": {}, \
\"measured\": {}, \
\"filtered_out\": \"{}\" }}",
if state.failed == 0 { "ok" } else { "failed" },
state.passed,
state.failed + state.allowed_fail,
Expand Down
9 changes: 2 additions & 7 deletions src/libtest/formatters/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {

self.write_plain(&format!(
"test {} has been running for over {} seconds\n",
desc.name,
TEST_WARN_TIMEOUT_S
desc.name, TEST_WARN_TIMEOUT_S
))
}

Expand Down Expand Up @@ -232,11 +231,7 @@ impl<T: Write> OutputFormatter for PrettyFormatter<T> {
} else {
format!(
". {} passed; {} failed; {} ignored; {} measured; {} filtered out\n\n",
state.passed,
state.failed,
state.ignored,
state.measured,
state.filtered_out
state.passed, state.failed, state.ignored, state.measured, state.filtered_out
)
};

Expand Down
9 changes: 2 additions & 7 deletions src/libtest/formatters/terse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ impl<T: Write> OutputFormatter for TerseFormatter<T> {
fn write_timeout(&mut self, desc: &TestDesc) -> io::Result<()> {
self.write_plain(&format!(
"test {} has been running for over {} seconds\n",
desc.name,
TEST_WARN_TIMEOUT_S
desc.name, TEST_WARN_TIMEOUT_S
))
}

Expand Down Expand Up @@ -231,11 +230,7 @@ impl<T: Write> OutputFormatter for TerseFormatter<T> {
} else {
format!(
". {} passed; {} failed; {} ignored; {} measured; {} filtered out\n\n",
state.passed,
state.failed,
state.ignored,
state.measured,
state.filtered_out
state.passed, state.failed, state.ignored, state.measured, state.filtered_out
)
};

Expand Down
Loading

0 comments on commit 003a135

Please sign in to comment.