name
}
+#[macro_export]
+macro_rules! test {
+ ($c:expr, $tname:expr, $s:stmt) => {
+ if $c.su.want_test($tname) {
+ debug!("{} starting", $tname);
+ $s
+ info!("{} completed", $tname);
+ } else {
+ trace!("{} skipped", $tname);
+ }
+ }
+}
+
+#[macro_export]
+macro_rules! ctx_with_setup {
+ {$ctx:ident} => {
+ impl Deref for $ctx {
+ type Target = self::Setup;
+ fn deref(&self) -> &self::Setup { &self.su }
+ }
+ }
+}
+
impl Setup {
+ pub fn want_test(&self, _tname: &str) -> bool { true }
+
#[throws(AE)]
pub fn new_window<'s>(&'s mut self, instance: &Instance, name: &str)
-> Window {
bob: Window,
spec: otter::spec::GameSpec,
}
+ctx_with_setup!{Ctx}
impl Ctx {
#[throws(AE)]
let mut c = Ctx { su, alice, bob, spec };
- c.drag().always_context("drag")?;
- let pc = c.rotate().always_context("rotate")?;
- c.drag_off(pc).always_context("drag off")?;
- c.unselect(pc).always_context("unselect")?;
+ test!(c, "drag", c.drag().always_context("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")?;
+ });
+
c.conflict().always_context("conflict handling")?;
debug!("finishing");