type Ctx = UsualCtx;
impl Ctx {
+ #[throws(Explode)]
+ fn bundles(&mut self) {
+ let bundle_file = self.su().ds.example_bundle();
+ let ds = self.su().ds.also(&[("bundle", &bundle_file)]);
+ self.otter(&ds.ss("upload-bundle @table@ @bundle@")?)?;
+ let mut bundles = self.otter(&ds.ss("list-bundles @table@")?)?;
+ let bundles = String::from(&mut bundles);
+ assert!(bundles.starts_with("00000.zip Loaded"));
+ self.otter(&ds.ss("download-bundle @table@ 0")?)?;
+ let st = Command::new("cmp").args(&[&bundle_file, "00000.zip"]).status()?;
+ if ! st.success() { panic!("cmp failed {}", st) }
+
+ let command = ds.ss("library-add --lib lemon @table@ example-lemon")?;
+ let added = self.some_library_add(&command)?;
+ assert_eq!( added.len(), 1 );
+
+ let output: String = self.otter(&ds.ss("list-pieces @table@")?)?.into();
+ assert!( Regex::new(
+ r#"(?m)(?:[^\w-]|^)example-lemon[^\w-].*\Wa lemon(?:\W|$)"#
+ )?
+ .find(&output)
+ .is_some(),
+ "got: {}", &output);
+
+ self.otter(&ds.ss("clear-game @table@")?)?;
+ self.otter(&ds.ss("reset @table@ demo")?)?;
+ }
}
#[throws(Explode)]
-fn tests(_c: Ctx) {
+fn tests(mut c: Ctx) {
+ test!(c, "bundles", c.bundles() ?);
}
#[throws(Explode)]
su.ds.setup_static_users(&mut *su.mgmt_conn.borrow_mut(), default())?;
}
- #[throws(Explode)]
- fn bundles(&mut self) {
- let bundle_file = self.su().ds.example_bundle();
- let ds = self.su().ds.also(&[("bundle", &bundle_file)]);
- self.otter(&ds.ss("upload-bundle @table@ @bundle@")?)?;
- let mut bundles = self.otter(&ds.ss("list-bundles @table@")?)?;
- let bundles = String::from(&mut bundles);
- assert!(bundles.starts_with("00000.zip Loaded"));
- self.otter(&ds.ss("download-bundle @table@ 0")?)?;
- let st = Command::new("cmp").args(&[&bundle_file, "00000.zip"]).status()?;
- if ! st.success() { panic!("cmp failed {}", st) }
-
- let command = ds.ss("library-add --lib lemon @table@ example-lemon")?;
- let added = self.some_library_add(&command)?;
- assert_eq!( added.len(), 1 );
-
- let output: String = self.otter(&ds.ss("list-pieces @table@")?)?.into();
- assert!( Regex::new(
- r#"(?m)(?:[^\w-]|^)example-lemon[^\w-].*\Wa lemon(?:\W|$)"#
- )?
- .find(&output)
- .is_some(),
- "got: {}", &output);
-
- self.otter(&ds.ss("clear-game @table@")?)?;
- self.otter(&ds.ss("reset @table@ demo")?)?;
- }
-
#[throws(Explode)]
fn save_load(&mut self) {
{
test!(c, "hidden-hand", c.hidden_hand() ?);
test!(c, "specs", c.chdir_root(|c| c.specs() ));
test!(c, "put-back", c.put_back() ?);
- test!(c, "bundles", c.bundles() ?);
test!(c, "save-load", c.save_load() ?);
}