chiark / gitweb /
wdt: Refactor otter method again
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Jan 2021 22:42:24 +0000 (22:42 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 10 Jan 2021 23:18:38 +0000 (23:18 +0000)
We want this to be a method in WindowGuard so we can control when we
do error checks.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
wdriver.rs
wdriver/wdt-altergame.rs

index d6ab8499f36e2c23d434cee9b7b0ca6fcb11e164..8cb9d186637cec3a93990f26f05e580205e5b462 100644 (file)
@@ -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<String> =
-      ["--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<String> =
+      ["--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 {
index ae8294e7a1f447f8b744e12929a67c8383706aad..a225bbffd8e513bb36d10e52153ead3420e5f483 100644 (file)
@@ -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)]