1 use std::process::Command; 2 version() -> String3pub fn version() -> String { 4 let output = Command::new(env!("HYPERFINE")) 5 .arg("--version") 6 .output() 7 .expect("failed to execute process"); 8 9 String::from_utf8(output.stdout).expect("invalid UTF-8 found") 10 } 11 12 #[cfg(test)] 13 mod test { 14 use super::*; 15 16 #[test] test_version()17 fn test_version() { 18 assert_eq!(version(), "hyperfine 1.17.0\n"); 19 } 20 } 21