From 4d7fa0310a0b90847d693d718349d9512f788fd2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 18 May 2021 00:55:45 +0100 Subject: [PATCH] apitest: Consolidate UsualCtx::prepare_game Signed-off-by: Ian Jackson --- apitest/at-otter.rs | 6 +++--- apitest/main.rs | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index f776b805..cbb78079 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -9,7 +9,7 @@ type Ctx = UsualCtx; impl Ctx { #[throws(Explode)] fn library_load(&mut self) { - prepare_game(&self.su().ds, &self.prctx, TABLE)?; + self.prepare_game()?; let command = self.su().ds.ss( "library-list @table@ chess-yellow-?" @@ -29,7 +29,7 @@ impl Ctx { #[throws(Explode)] fn hidden_hand(&mut self) { - prepare_game(&self.su().ds, &default(), TABLE)?; + self.prepare_game()?; let mut alice = self.connect_player(&self.alice)?; let mut bob = self.connect_player(&self.bob)?; self.su_mut().mgmt_conn().fakerng_load(&[&"1",&"0"])?; @@ -185,8 +185,8 @@ impl Ctx { #[throws(Explode)] fn put_back(&mut self) { // Put things back for the ad-hoc human tester + self.prepare_game()?; let su = self.su(); - prepare_game(&su.ds, &self.prctx, TABLE)?; su.ds.setup_static_users(&mut *su.mgmt_conn.borrow_mut(), default())?; } diff --git a/apitest/main.rs b/apitest/main.rs index e447681d..d230f644 100644 --- a/apitest/main.rs +++ b/apitest/main.rs @@ -493,6 +493,11 @@ impl UsualCtx { self.su().ds.otter_prctx(&self.prctx, &args)? } + #[throws(Explode)] + pub fn prepare_game(&mut self) { + prepare_game(&self.su().ds, &self.prctx, TABLE)?; + } + #[throws(Explode)] fn some_library_add(&mut self, command: &[String]) -> Vec { let add_err = self.otter(command) -- 2.30.2