提交 d1940912 编写于 作者: M Martin Nordholts

test_get_dbpath_for_term(): handle non-utf8 paths

上级 54a6bb7f
......@@ -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");
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册