wofi_select works

timeout_old
Tassilo Horn 4 years ago
parent eccc0c5c3c
commit 0291efa989
  1. 8
      src/util.rs

@ -38,16 +38,16 @@ where
let output = wofi.wait_with_output().expect("Failed to read stdout"); let output = wofi.wait_with_output().expect("Failed to read stdout");
let choice = String::from_utf8_lossy(&output.stdout); let choice = String::from_utf8_lossy(&output.stdout);
// FIXME: Remove trailing \n from choice. let mut choice = String::from(choice);
//println!("choice: {:?}", choice); choice.pop(); // Remove trailing \n from choice.
map.get(&*choice).copied() map.get(&choice).copied()
} }
#[test] #[test]
#[ignore = "interactive test requiring user input"]
fn test_wofi_select() { fn test_wofi_select() {
let choices = vec!["a", "b", "c"]; let choices = vec!["a", "b", "c"];
let choice = wofi_select("Choose wisely", &choices); let choice = wofi_select("Choose wisely", &choices);
println!("choice: {:?}", choice);
assert!(choice.is_some()); assert!(choice.is_some());
assert!(choices.contains(choice.unwrap())); assert!(choices.contains(choice.unwrap()));
} }

Loading…
Cancel
Save