about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-08-09 22:59:58 +0200
committerGitHub <noreply@github.com>2023-08-09 22:59:58 +0200
commit128cc065158d259f77479b20316a89ed2ac7a6ca (patch)
tree0da7670f3080b0584601e9f8c2eb0469344d797e
parent7d78885a8e76c7b598879bed748d426426db0071 (diff)
parentd1940912e5006dd5927f5d3232c2ac427dd722f4 (diff)
downloadrust-128cc065158d259f77479b20316a89ed2ac7a6ca.tar.gz
rust-128cc065158d259f77479b20316a89ed2ac7a6ca.zip
Rollup merge of #114377 - Enselic:test_get_dbpath_for_term-utf-8, r=thomcc
test_get_dbpath_for_term(): handle non-utf8 paths (fix FIXME)

Removes a FIXME for #9639

Part of #44366 which is E-help-wanted

The remaining two FIXMEs for #9639 are considerably more complicated, so I will create separate PRs for them.
-rw-r--r--library/test/src/term/terminfo/searcher/tests.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/library/test/src/term/terminfo/searcher/tests.rs b/library/test/src/term/terminfo/searcher/tests.rs
index 4227a585e2f..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!(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");
 }