use std::process; #[test] fn read_file() { let args = vec![String::new(), String::from("duct"), String::from("./cargo.toml")]; let cfg = minigrep::Config::build(&args).unwrap_or_else(|err| { panic!("parse args error: {err}"); }); if let Err(_e) = minigrep::run(cfg) { panic!("run err"); } } #[test] fn one_result() { let query = "duct"; let contents = "\ Rust: safe, fast, productive. Pick three"; assert_eq!(vec!["safe, fast, productive."], minigrep::search(query, contents)); } #[test] fn case_insensitive_result() { let query = "rUsT"; let contents = "\ Rust: safe, fast, productive. Pick three Trust me."; assert_eq!(vec!["Rust:", "Trust me."], minigrep::search_case_insensitive(query, contents)); }