]> git.proxmox.com Git - rustc.git/blame - vendor/term-0.6.1/tests/terminfo.rs
Merge tag 'debian/1.52.1+dfsg1-1_exp2' into proxmox/buster
[rustc.git] / vendor / term-0.6.1 / tests / terminfo.rs
CommitLineData
f20569fa
XL
1use std::fs;
2use std::io;
3use term::terminfo::TermInfo;
4use term::terminfo::TerminfoTerminal;
5use term::Terminal;
6
7#[test]
8fn test_parse() {
9 for f in fs::read_dir("tests/data/").unwrap() {
10 let _ = TermInfo::from_path(f.unwrap().path()).unwrap();
11 }
12}
13
14#[test]
15fn test_supports_color() {
16 fn supports_color(term: &str) -> bool {
17 let terminfo = TermInfo::from_path(format!("tests/data/{}", term)).unwrap();
18 let term = TerminfoTerminal::new_with_terminfo(io::stdout(), terminfo);
19 term.supports_color()
20 }
21 assert!(supports_color("linux"));
22 assert!(!supports_color("dumb"));
23}
24
25#[test]
26fn test_fallback() {
27 TermInfo::from_name("ansi-cargo-test").expect("failed to use fallback");
28 assert!(TermInfo::from_name("really-bad-terminal").is_err());
29}