Skip to content

Commit d194091

Browse files
committed
test_get_dbpath_for_term(): handle non-utf8 paths
1 parent 54a6bb7 commit d194091

File tree

1 file changed

+4
-6
lines changed
  • library/test/src/term/terminfo/searcher

1 file changed

+4
-6
lines changed

library/test/src/term/terminfo/searcher/tests.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@ fn test_get_dbpath_for_term() {
66
// woefully inadequate test coverage
77
// note: current tests won't work with non-standard terminfo hierarchies (e.g., macOS's)
88
use std::env;
9-
// FIXME (#9639): This needs to handle non-utf8 paths
10-
fn x(t: &str) -> String {
11-
let p = get_dbpath_for_term(t).expect("no terminfo entry found");
12-
p.to_str().unwrap().to_string()
9+
fn x(t: &str) -> PathBuf {
10+
get_dbpath_for_term(t).expect(&format!("no terminfo entry found for {t:?}"))
1311
}
14-
assert_eq!(x("screen"), "/usr/share/terminfo/s/screen");
12+
assert_eq!(x("screen"), PathBuf::from("/usr/share/terminfo/s/screen"));
1513
assert_eq!(get_dbpath_for_term(""), None);
1614
env::set_var("TERMINFO_DIRS", ":");
17-
assert_eq!(x("screen"), "/usr/share/terminfo/s/screen");
15+
assert_eq!(x("screen"), PathBuf::from("/usr/share/terminfo/s/screen"));
1816
env::remove_var("TERMINFO_DIRS");
1917
}

0 commit comments

Comments
 (0)