]> git.proxmox.com Git - rustc.git/blob - library/term/src/terminfo/searcher/tests.rs
New upstream version 1.54.0+dfsg1
[rustc.git] / library / term / src / terminfo / searcher / tests.rs
1 use super::*;
2
3 #[test]
4 #[ignore = "buildbots don't have ncurses installed and I can't mock everything I need"]
5 fn test_get_dbpath_for_term() {
6 // woefully inadequate test coverage
7 // note: current tests won't work with non-standard terminfo hierarchies (e.g., macOS's)
8 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()
13 }
14 assert!(x("screen") == "/usr/share/terminfo/s/screen");
15 assert!(get_dbpath_for_term("") == None);
16 env::set_var("TERMINFO_DIRS", ":");
17 assert!(x("screen") == "/usr/share/terminfo/s/screen");
18 env::remove_var("TERMINFO_DIRS");
19 }