#[ext(pub)]
impl<T,E> Result<T,E> {
- fn always_context(self, msg: &'static str) -> anyhow::Result<T>
+ fn did(self, msg: &'static str) -> anyhow::Result<T>
where Self: anyhow::Context<T,E>
{
let x = self.context(msg);
let ds = prepare_tmpdir(&opts, ¤t_exe)?;
let (mgmt_conn, server_child) =
- prepare_gameserver(&cln, &ds).always_context("setup game server")?;
+ prepare_gameserver(&cln, &ds).did("setup game server")?;
let mgmt_conn = mgmt_conn.for_game(
TABLE.parse()?,
&mut |s: &OsStr| s.to_str().unwrap().starts_with("--test=")
)?;
- prepare_xserver(&cln, &core.ds).always_context("setup X server")?;
+ prepare_xserver(&cln, &core.ds).did("setup X server")?;
let final_hook = FinalInfoCollection;
- prepare_geckodriver(&opts, &cln).always_context("setup webdriver server")?;
+ prepare_geckodriver(&opts, &cln).did("setup webdriver server")?;
let (driver, screenshot_count, windows_squirreled) =
- prepare_thirtyfour(&core.ds).always_context("prepare web session")?;
+ prepare_thirtyfour(&core.ds).did("prepare web session")?;
(Setup {
core,
impl UsualSetup {
#[throws(AE)]
pub fn new(exe_module_path: &str) -> UsualSetup {
- let (mut su, inst) = setup(exe_module_path).always_context("setup")?;
+ let (mut su, inst) = setup(exe_module_path).did("usual setup")?;
let [alice, bob] : [Window; 2] =
su.setup_static_users(&inst)?.try_into().unwrap();
let spec = su.ds.game_spec_data()?;
}
Ok::<_,AE>(())
})()
- .context(desc).context("check link")?
+ .context(desc).did("check link")?
}
#[throws(AE)]
self.check_link(desc, Some(url))?;
Ok::<_,AE>(())
})()
- .context(desc).context("test link")?
+ .context(desc).did("test link")?
}
#[throws(AE)]
self.check_link(desc, None)?;
Ok::<_,AE>(())
})()
- .context(desc).context("test remove link")?
+ .context(desc).did("test remove link")?
}
}
.click_and_hold()
.move_w(&alice, p2)?
.release()
- .perform()?;
+ .perform()
+ .did("click and hold while paused")?;
let got_p2 = p.posg()?;
assert_eq!(p2, got_p2);
.move_pos(&hand)?
.click()
.perform()
- .context("select hand")?;
+ .did("select hand")?;
w.synch()?;
w.action_chain()
.key_down('C')
.key_up('C')
.perform()
- .context("claim hand")?;
+ .did("claim hand")?;
w.synch()?;
w.action_chain()
.click()
.perform()
- .context("deselect")?;
+ .did("deselect")?;
chk(&mut w, HAND, Some(ALICE))?;
.move_pos(&hand)?
.click()
.perform()
- .context("select hand")?;
+ .did("select hand")?;
w.synch()?;
w.action_chain()
.key_down('C')
.key_up('C')
.perform()
- .context("unclaim hand")?;
+ .did("unclaim hand")?;
w.action_chain()
.click()
.perform()
- .context("deselect")?;
+ .did("deselect")?;
chk(&mut w, HAND, None)?;
}
.key_down('l')
.key_up('l')
.perform()
- .always_context("rotate")?;
+ .did("rotate")?;
chk(&w)?;
w.synch()?;
.move_w(&w, try_end)?
.release()
.perform()
- .always_context("drag off")?;
+ .did("drag off")?;
w.synch()?;
chk(&w, exp_end)?;
.click()
.release()
.perform()
- .always_context("unselect by clicking elsewhere")?;
+ .did("unselect by clicking elsewhere")?;
chk(&w)?;
w.synch()?;
.click()
.click()
.perform()
- .context("select and release")?;
+ .did("select and release")?;
w.synch()?;
.release()
.perform()
- .context("conflicting drag")?;
+ .did("conflicting drag")?;
}
paused.resume()?;
test!(c, "drag", c.drag()?);
test!(c, "drag-rotate-unselect", {
- let pc = c.rotate().always_context("rotate")?;
- c.drag_off(pc).always_context("drag off")?;
- c.unselect(pc).always_context("unselect")?;
+ let pc = c.rotate().did("rotate")?;
+ c.drag_off(pc).did("drag off")?;
+ c.unselect(pc).did("unselect")?;
});
test!(c, "conflict", c.conflict()?);