diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:24 +0000 |
commit | 023939b627b7dc93b01471f7d41fb8553ddb4ffa (patch) | |
tree | 60fc59477c605c72b0a1051409062ddecc43f877 /library/test | |
parent | Adding debian version 1.72.1+dfsg1-1. (diff) | |
download | rustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.tar.xz rustc-023939b627b7dc93b01471f7d41fb8553ddb4ffa.zip |
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/test')
-rw-r--r-- | library/test/src/formatters/junit.rs | 2 | ||||
-rw-r--r-- | library/test/src/lib.rs | 4 | ||||
-rw-r--r-- | library/test/src/term/terminfo/searcher/tests.rs | 12 | ||||
-rw-r--r-- | library/test/src/types.rs | 2 |
4 files changed, 9 insertions, 11 deletions
diff --git a/library/test/src/formatters/junit.rs b/library/test/src/formatters/junit.rs index 9f5bf2436..a211ebf1d 100644 --- a/library/test/src/formatters/junit.rs +++ b/library/test/src/formatters/junit.rs @@ -32,7 +32,7 @@ fn str_to_cdata(s: &str) -> String { let escaped_output = s.replace("]]>", "]]]]><![CDATA[>"); let escaped_output = escaped_output.replace("<?", "<]]><![CDATA[?"); // We also smuggle newlines as 
 so as to keep all the output on one line - let escaped_output = escaped_output.replace("\n", "]]>
<![CDATA["); + let escaped_output = escaped_output.replace('\n', "]]>
<![CDATA["); // Prune empty CDATA blocks resulting from any escaping let escaped_output = escaped_output.replace("<![CDATA[]]>", ""); format!("<![CDATA[{}]]>", escaped_output) diff --git a/library/test/src/lib.rs b/library/test/src/lib.rs index b40b6009e..64d10dd57 100644 --- a/library/test/src/lib.rs +++ b/library/test/src/lib.rs @@ -21,6 +21,7 @@ #![feature(process_exitcode_internals)] #![feature(panic_can_unwind)] #![feature(test)] +#![cfg_attr(not(bootstrap), allow(internal_features))] // Public reexports pub use self::bench::{black_box, Bencher}; @@ -183,8 +184,7 @@ pub fn test_main_static_abort(tests: &[&TestDescAndFn]) { let test = tests .into_iter() - .filter(|test| test.desc.name.as_slice() == name) - .next() + .find(|test| test.desc.name.as_slice() == name) .unwrap_or_else(|| panic!("couldn't find a test with the provided name '{name}'")); let TestDescAndFn { desc, testfn } = test; match testfn.into_runnable() { diff --git a/library/test/src/term/terminfo/searcher/tests.rs b/library/test/src/term/terminfo/searcher/tests.rs index 4227a585e..e1edd3b25 100644 --- a/library/test/src/term/terminfo/searcher/tests.rs +++ b/library/test/src/term/terminfo/searcher/tests.rs @@ -6,14 +6,12 @@ fn test_get_dbpath_for_term() { // woefully inadequate test coverage // note: current tests won't work with non-standard terminfo hierarchies (e.g., macOS's) use std::env; - // FIXME (#9639): This needs to handle non-utf8 paths - fn x(t: &str) -> String { - let p = get_dbpath_for_term(t).expect("no terminfo entry found"); - p.to_str().unwrap().to_string() + fn x(t: &str) -> PathBuf { + get_dbpath_for_term(t).expect(&format!("no terminfo entry found for {t:?}")) } - assert!(x("screen") == "/usr/share/terminfo/s/screen"); - assert!(get_dbpath_for_term("") == None); + assert_eq!(x("screen"), PathBuf::from("/usr/share/terminfo/s/screen")); + assert_eq!(get_dbpath_for_term(""), None); env::set_var("TERMINFO_DIRS", ":"); - assert!(x("screen") == "/usr/share/terminfo/s/screen"); + assert_eq!(x("screen"), PathBuf::from("/usr/share/terminfo/s/screen")); env::remove_var("TERMINFO_DIRS"); } diff --git a/library/test/src/types.rs b/library/test/src/types.rs index 504ceee7f..1a8ae889c 100644 --- a/library/test/src/types.rs +++ b/library/test/src/types.rs @@ -224,7 +224,7 @@ impl TestDesc { } } - /// Returns None for ignored test or that that are just run, otherwise give a description of the type of test. + /// Returns None for ignored test or tests that are just run, otherwise returns a description of the type of test. /// Descriptions include "should panic", "compile fail" and "compile". pub fn test_mode(&self) -> Option<&'static str> { if self.ignore { |