Cotton code
26 lines · 970 B · RustRaw
//! The reach's own tests.use super::*;fn file(id: &str, name: &str, is_mine: bool) -> ReachFile {    ReachFile {        id: id.to_string(),        name: name.to_string(),        is_mine,    }}/// RULE: a `database` outside reach answers exactly as a `database` that does not exist — "no such database" — so a seat token cannot probe for the owner's other databases by telling the two apart.#[test]fn a_place_outside_reach_answers_like_a_place_that_does_not_exist() {    let seat = Reach::only(file("place-b", "Product team", false));    assert_eq!(seat.place("place-b").map(|f| f.id.as_str()), Ok("place-b"));    let outside = seat.place("mine-a").unwrap_err().to_string();    let missing = seat        .place("00000000-0000-4000-8000-000000000000")        .unwrap_err()        .to_string();    assert_eq!(outside, "no such database");    assert_eq!(outside, missing);    assert!(seat.mine().is_none(), "a seat token never reaches Mine");}