From: Ian Jackson Date: Tue, 18 May 2021 00:02:38 +0000 (+0100) Subject: apitest: Consolidate reset_game and provide in UsualCtx X-Git-Tag: otter-0.6.0~170 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=3db23ff1c6d5dae8918f56b2edf56b056a6e2cc3;p=otter.git apitest: Consolidate reset_game and provide in UsualCtx We are going to want to do some extra tracking Signed-off-by: Ian Jackson --- diff --git a/apitest/at-bundles.rs b/apitest/at-bundles.rs index 34c7059d..141ea1e3 100644 --- a/apitest/at-bundles.rs +++ b/apitest/at-bundles.rs @@ -45,7 +45,7 @@ impl Ctx { self.check_library_item("lemon","example-lemon","a lemon")?; self.otter(&ds.ss("clear-game @table@")?)?; - self.otter(&ds.ss("reset @table@ demo")?)?; + self.reset_game(&ds.ss("reset @table@ demo")?)?; } } diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index cbb78079..b8b306c2 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -146,7 +146,7 @@ impl Ctx { a_pieces[a_pawns[0]].pos); let command = self.su().ds.ss("reset @table@ demo")?; - self.otter(&command)?; + self.reset_game(&command)?; } #[throws(Explode)] @@ -178,7 +178,7 @@ impl Ctx { if !(py || gy) { break } let command = self.su().ds.also(&[("game",&game),("perm",&perm)]) .ss("reset --reset-table @perm@ @table@ @game@")?; - self.otter(&command).context(perm).context(game)?; + self.reset_game(&command).context(perm).context(game)?; } } diff --git a/apitest/main.rs b/apitest/main.rs index d230f644..955d827c 100644 --- a/apitest/main.rs +++ b/apitest/main.rs @@ -498,6 +498,11 @@ impl UsualCtx { prepare_game(&self.su().ds, &self.prctx, TABLE)?; } + #[throws(AE)] + pub fn reset_game>(&mut self, args: &[S]) -> OtterOutput { + self.otter(args)? + } + #[throws(Explode)] fn some_library_add(&mut self, command: &[String]) -> Vec { let add_err = self.otter(command)