From 18f9e3f7cfee907aba58db246a5196f3e87567a8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 20 May 2021 01:31:24 +0100 Subject: [PATCH] bundles: Test finding specs in bundles Signed-off-by: Ian Jackson --- apitest/at-bundles.rs | 17 +++++++++++++---- apitest/main.rs | 12 ++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/apitest/at-bundles.rs b/apitest/at-bundles.rs index ad2f9c1f..05dbbffd 100644 --- a/apitest/at-bundles.rs +++ b/apitest/at-bundles.rs @@ -10,15 +10,24 @@ impl Ctx { #[throws(Explode)] fn bundles(&mut self) { self.upload_and_check_bundle( - "test-bundle","lemon", "example-lemon","a lemon" - )?; + "test-bundle","lemon", "example-lemon","a lemon", + &mut |_|Ok(()))?; } #[throws(Explode)] fn big(&mut self) { self.upload_and_check_bundle( - "big-bundle","duped-example", "chess-purple-cannon", "a purple cannon" - )?; + "big-bundle","duped-example", "chess-purple-cannon", "a purple cannon", + &mut |ctx| + { + ctx.su().mgmt_conn.borrow_mut().alter_game( + vec![ MGI::ResetFromNamedSpec { + spec: "modded-spec".to_owned(), + }], + None, + )?; + Ok(()) + })?; } #[throws(Explode)] diff --git a/apitest/main.rs b/apitest/main.rs index 9336a0d0..2f6a6ccc 100644 --- a/apitest/main.rs +++ b/apitest/main.rs @@ -587,10 +587,12 @@ impl UsualCtx { } #[throws(Explode)] - pub fn upload_and_check_bundle(&mut self, bundle_stem: &str, - libname: &str, item: &str, - desc: &str) - { + pub fn upload_and_check_bundle( + &mut self, bundle_stem: &str, + libname: &str, item: &str, + desc: &str, + with: &mut dyn FnMut(&mut UsualCtx) -> Result<(), Explode> + ) { let ds = self.su().ds.also(&[("bundle_stem", &bundle_stem)]); let bundle_file = ds.subst("@examples@/@bundle_stem@.zip")?; let ds = ds.also(&[("bundle", &bundle_file)]); @@ -616,6 +618,8 @@ impl UsualCtx { self.check_library_item(libname,item,desc)?; + with(self)?; + self.otter(&ds.ss("clear-game @table@")?)?; self.reset_game(&ds.ss("reset @table@ demo")?)?; } -- 2.30.2