From: Ian Jackson Date: Sun, 10 Jan 2021 22:42:24 +0000 (+0000) Subject: wdt: Refactor otter method again X-Git-Tag: otter-0.3.0~126 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=6841d420d298d4a999ebf02bb33151d00a92cb0c;p=otter.git wdt: Refactor otter method again We want this to be a method in WindowGuard so we can control when we do error checks. Signed-off-by: Ian Jackson --- diff --git a/wdriver.rs b/wdriver.rs index d6ab8499..8cb9d186 100644 --- a/wdriver.rs +++ b/wdriver.rs @@ -918,17 +918,6 @@ impl Setup { self.windows_squirreled.push(name.to_owned()); window } - - #[throws(AE)] - pub fn otter(&mut self, w: &Window, verb: &[&str], args: &[&str]) { - let args : Vec = - ["--account", "server:"].iter().cloned().map(Into::into) - .chain(verb.iter().cloned().map(Into::into)) - .chain(iter::once(w.table())) - .chain(args.iter().cloned().map(Into::into)) - .collect(); - self.ds.otter(&args)?; - } } impl Setup { @@ -983,6 +972,18 @@ fn screenshot(driver: &T4d, count: &mut ScreenShotCount, slug: &str) { } impl<'g> WindowGuard<'g> { + + #[throws(AE)] + pub fn otter(&mut self, verb: &[&str], args: &[&str]) { + let args : Vec = + ["--account", "server:"].iter().cloned().map(Into::into) + .chain(verb.iter().cloned().map(Into::into)) + .chain(iter::once(self.w.table())) + .chain(args.iter().cloned().map(Into::into)) + .collect(); + self.su.ds.otter(&args)?; + } + #[throws(AE)] fn synch_raw(&mut self) { let cmd = MgmtCommand::AlterGame { diff --git a/wdriver/wdt-altergame.rs b/wdriver/wdt-altergame.rs index ae8294e7..a225bbff 100644 --- a/wdriver/wdt-altergame.rs +++ b/wdriver/wdt-altergame.rs @@ -40,7 +40,7 @@ impl Ctx { #[throws(AE)] fn otter(&mut self, verb: &[&str], args: &[&str]) { - self.su.otter(&self.alice, verb, args)? + self.su.w(&self.alice)?.otter(verb, args)? } #[throws(AE)]