//! `bxctl deny` is another name for `bxctl refuse`: every argument list means the same under both //! (M4b spec, section 2). Do not edit. use bxctl::cli::{USAGE, parse}; use std::path::Path; fn under(command: &str, rest: &[&str]) -> Vec { std::iter::once(command) .chain(rest.iter().copied()) .map(str::to_string) .collect() } #[test] fn deny_parses_as_refuse() { let cases: &[&[&str]] = &[ &["41"], &["41", "--reason", "not on a Friday"], &["--reason", "no", "41"], &["41", "--admin-socket", "/tmp/a.sock"], &["41", "--reason", "x", "--admin-socket", "/tmp/a.sock"], &[], &["x41"], &["41", "--reason"], &["41", "42"], &["41", "--bogus"], ]; for rest in cases { let home = Path::new("/srv/bx"); assert_eq!( parse(&under("deny", rest), home), parse(&under("refuse", rest), home), "{rest:?}" ); } } #[test] fn usage_names_deny() { assert!(USAGE.contains("bxctl deny "), "{USAGE}"); assert!(USAGE.contains("bxctl refuse "), "{USAGE}"); }