diff options
| author | Martin Nordholts <enselic@gmail.com> | 2023-08-02 20:47:56 +0200 |
|---|---|---|
| committer | Martin Nordholts <enselic@gmail.com> | 2023-08-02 20:57:05 +0200 |
| commit | d1940912e5006dd5927f5d3232c2ac427dd722f4 (patch) | |
| tree | 2630686227226aeec492bc2e62224cd926bbac9a | |
| parent | 54a6bb7f0d007e243df1f9c858d2785ed0caadd8 (diff) | |
| download | rust-d1940912e5006dd5927f5d3232c2ac427dd722f4.tar.gz rust-d1940912e5006dd5927f5d3232c2ac427dd722f4.zip | |
test_get_dbpath_for_term(): handle non-utf8 paths
| -rw-r--r-- | library/test/src/term/terminfo/searcher/tests.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/library/test/src/term/terminfo/searcher/tests.rs b/library/test/src/term/terminfo/searcher/tests.rs index 019e6293909..e1edd3b25cf 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_eq!(x("screen"), "/usr/share/terminfo/s/screen"); + assert_eq!(x("screen"), PathBuf::from("/usr/share/terminfo/s/screen")); assert_eq!(get_dbpath_for_term(""), None); env::set_var("TERMINFO_DIRS", ":"); - assert_eq!(x("screen"), "/usr/share/terminfo/s/screen"); + assert_eq!(x("screen"), PathBuf::from("/usr/share/terminfo/s/screen")); env::remove_var("TERMINFO_DIRS"); } |
