1 // Copyright 2020-2021 Ian Jackson and contributors to Otter
2 // SPDX-License-Identifier: AGPL-3.0-or-later
3 // There is NO WARRANTY.
11 fn bundles(&mut self) {
12 self.upload_and_check_bundle(
13 "test-bundle","lemon", "example-lemon","a lemon",
19 self.upload_and_check_bundle(
20 "big-bundle","duped-example", "chess-purple-cannon", "a purple cannon",
23 ctx.otter_resetting(&ctx.ds().gss("reset modded-spec")?)?;
25 let alice = ctx.connect_player(&ctx.alice)?;
26 let pieces = alice.pieces::<PIA>()?;
28 for expect in &["a purple knight", "a yellow bishop"] {
29 let _: PIA = pieces.find_by_desc_glob(expect);
37 fn builtin_spec(&mut self) {
38 self.su().mgmt_conn.borrow_mut().alter_game(
39 vec![ MGI::ResetFromNamedSpec {
40 spec: "demo".to_owned(),
47 fn reset_with_bundles(&mut self) {
48 self.clear_reset_to_demo()?;
50 // check that the spec is not accessible now
52 &G("reset demo-in-test-bundle")
54 let e: ExitStatusError = e.downcast().unwrap();
55 assert_eq!(e.0.code(), Some(12));
58 &G("reset demo-in-test-bundle @examples@/test-bundle.zip")
61 self.clear_reset_to_demo()?;
66 fn tests(mut c: Ctx) {
67 test!(c, "bundles", c.bundles() ?);
68 test!(c, "reset-with-bundles", c.reset_with_bundles() ?);
69 test!(c, "big", c.big() ?);
70 test!(c, "builtin-spec", c.builtin_spec() ?);
75 tests(Ctx::setup()?)?;