use std::borrow::Cow;
use super::defs::*;
#[test]
fn capability_declared() {
test_require_capability("5161capa", "ENABLE");
}
#[test]
fn command_works() {
let setup = set_up();
let mut client = setup.connect("5161test");
command!(mut responses = client, c("ENABLE RANDOMLY-LOSE"));
assert_tagged_ok(responses.pop().unwrap());
has_untagged_response_matching! {
s::Response::Enabled(ref exts) in responses => {
assert!(exts.is_empty());
}
}
command!(mut responses = client, c("ENABLE ENABLE"));
assert_tagged_ok(responses.pop().unwrap());
has_untagged_response_matching! {
s::Response::Enabled(ref exts) in responses => {
assert!(exts.is_empty());
}
}
command!(mut responses = client, c("ENABLE XYZZY"));
assert_tagged_ok(responses.pop().unwrap());
has_untagged_response_matching! {
s::Response::Enabled(ref exts) in responses => {
assert_eq!(1, exts.len());
assert!(exts.contains(&Cow::Borrowed("XYZZY")));
}
}
command!(mut responses = client, c("ENABLE XYZZY ENABLE RANDOMLY-LOSE"));
assert_tagged_ok(responses.pop().unwrap());
has_untagged_response_matching! {
s::Response::Enabled(ref exts) in responses => {
assert_eq!(1, exts.len());
assert!(exts.contains(&Cow::Borrowed("XYZZY")));
}
}
command!(mut responses = client, c("ENABLE ENABLE XYZZY RANDOMLY-LOSE"));
assert_tagged_ok(responses.pop().unwrap());
has_untagged_response_matching! {
s::Response::Enabled(ref exts) in responses => {
assert_eq!(1, exts.len());
assert!(exts.contains(&Cow::Borrowed("XYZZY")));
}
}
}