use std::borrow::Cow;
use super::defs::*;
#[test]
fn capability_declared() {
test_require_capability("2971capa", "ID");
}
#[test]
fn command_works() {
let setup = set_up();
let mut client = setup.connect("2971test");
command!(mut responses = client,
c(r#"ID ("name" "test" "version" "1.0")"#));
assert_tagged_ok(responses.pop().unwrap());
has_untagged_response_matching! {
s::Response::Id(ref ids) in responses => {
assert!(ids.contains(&Some(Cow::Borrowed("name"))));
assert!(ids.contains(&Some(Cow::Borrowed(env!("CARGO_PKG_NAME")))));
}
};
client = setup.connect("2971test");
ok_command!(client, c("ID NIL"));
client = setup.connect("2971test");
ok_command!(client, c(r#"ID ("name" NIL "version" "0.1")"#));
client = setup.connect("2971test");
ok_command!(client, c(r#"ID ("name" "foo" "version" NIL)"#));
client = setup.connect("2971test");
ok_command!(client, c(r#"ID ("name" "foo" "x-foo" "bar")"#));
}