Skip to content

Commit e738273

Browse files
committed
[nextest-runner] update to quick-junit 0.5.0
This results in some nice code cleanup.
1 parent a28f230 commit e738273

File tree

4 files changed

+16
-24
lines changed

4 files changed

+16
-24
lines changed

Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ owo-colors = { version = "4.0.0", features = ["supports-colors"] }
2828
newtype-uuid = { version = "1.1.0", features = ["v4"] }
2929
nextest-metadata = { version = "0.12.0", path = "nextest-metadata" }
3030
nextest-workspace-hack = "0.1.0"
31-
quick-junit = "0.4.0"
31+
quick-junit = "0.5.0"
3232
swrite = "0.1.0"
3333
target-spec = { version = "3.2.1", features = ["custom", "summaries"] }
3434
target-spec-miette = "0.4.0"

nextest-runner/src/reporter/aggregator.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ use crate::{
1414
};
1515
use camino::Utf8PathBuf;
1616
use debug_ignore::DebugIgnore;
17-
use quick_junit::{NonSuccessKind, Report, TestCase, TestCaseStatus, TestRerun, TestSuite};
17+
use quick_junit::{
18+
NonSuccessKind, Report, TestCase, TestCaseStatus, TestRerun, TestSuite, XmlString,
19+
};
1820
use std::{borrow::Cow, collections::HashMap, fs::File};
1921

2022
#[derive(Clone, Debug)]
@@ -245,7 +247,7 @@ enum TestcaseOrRerun<'a> {
245247
}
246248

247249
impl TestcaseOrRerun<'_> {
248-
fn set_message(&mut self, message: impl Into<String>) -> &mut Self {
250+
fn set_message(&mut self, message: impl Into<XmlString>) -> &mut Self {
249251
match self {
250252
TestcaseOrRerun::Testcase(testcase) => {
251253
testcase.status.set_message(message.into());
@@ -257,7 +259,7 @@ impl TestcaseOrRerun<'_> {
257259
self
258260
}
259261

260-
fn set_description(&mut self, description: impl Into<String>) -> &mut Self {
262+
fn set_description(&mut self, description: impl Into<XmlString>) -> &mut Self {
261263
match self {
262264
TestcaseOrRerun::Testcase(testcase) => {
263265
testcase.status.set_description(description.into());
@@ -269,7 +271,7 @@ impl TestcaseOrRerun<'_> {
269271
self
270272
}
271273

272-
fn set_system_out(&mut self, system_out: impl Into<String>) -> &mut Self {
274+
fn set_system_out(&mut self, system_out: impl Into<XmlString>) -> &mut Self {
273275
match self {
274276
TestcaseOrRerun::Testcase(testcase) => {
275277
testcase.set_system_out(system_out.into());
@@ -281,7 +283,7 @@ impl TestcaseOrRerun<'_> {
281283
self
282284
}
283285

284-
fn set_system_err(&mut self, system_err: impl Into<String>) -> &mut Self {
286+
fn set_system_err(&mut self, system_err: impl Into<XmlString>) -> &mut Self {
285287
match self {
286288
TestcaseOrRerun::Testcase(testcase) => {
287289
testcase.set_system_err(system_err.into());
@@ -305,7 +307,7 @@ fn set_execute_status_props(
305307
if !is_success {
306308
let description = output.heuristic_extract_description(execute_status.result);
307309
if let Some(description) = description {
308-
out.set_description(description.display_human().to_junit_output());
310+
out.set_description(description.display_human().to_string());
309311
}
310312
}
311313

nextest-runner/src/reporter/helpers.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
use crate::runner::{AbortStatus, ExecutionResult};
55
use bstr::ByteSlice;
66
use once_cell::sync::Lazy;
7-
use quick_junit::Output;
87
use regex::bytes::{Regex, RegexBuilder};
98
use std::fmt;
109

@@ -121,15 +120,6 @@ pub struct ByteSubslice<'a> {
121120
#[derive(Clone, Copy, Debug)]
122121
pub struct DescriptionKindDisplay<'a>(DescriptionKind<'a>);
123122

124-
impl<'a> DescriptionKindDisplay<'a> {
125-
/// Returns the displayer in a JUnit-compatible format.
126-
///
127-
/// This format filters out invalid XML characters.
128-
pub fn to_junit_output(self) -> Output {
129-
Output::new(self.to_string())
130-
}
131-
}
132-
133123
impl fmt::Display for DescriptionKindDisplay<'_> {
134124
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
135125
match self.0 {

0 commit comments

Comments
 (0)