From 3db23ff1c6d5dae8918f56b2edf56b056a6e2cc3 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 18 May 2021 01:02:38 +0100 Subject: [PATCH] apitest: Consolidate reset_game and provide in UsualCtx We are going to want to do some extra tracking Signed-off-by: Ian Jackson --- apitest/at-bundles.rs | 2 +- apitest/at-otter.rs | 4 ++-- apitest/main.rs | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) 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) -- 2.30.2