mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-11-07 17:21:49 -10:00
Skip the golem push test when the prepared world is missing
CI has no extracted 26.3 data, so the test asserted data that is not there; it now returns instead, as the other world-backed mob tests do.
This commit is contained in:
1 parent
55a6eddf8e
commit
630e4dc8bc
1 file changed
+10
-6
@@ -3659,7 +3659,9 @@ mod iron_golem_push_tests {
|
||||
/// so a creeper or an animal leaves the golem's random alone.
|
||||
#[test]
|
||||
fn an_iron_golem_targets_the_monster_that_bumps_it() {
|
||||
let hits = |victim: Mob| {
|
||||
// CI has no prepared 26.3 data, so a world that does not build skips
|
||||
// the whole check rather than asserting the data exists.
|
||||
let hits = |victim: Mob| -> Option<u32> {
|
||||
let seen = victim.seen(None);
|
||||
let mut hits = 0;
|
||||
let ran = with_test_world(&[seen], |w, _| {
|
||||
@@ -3673,21 +3675,23 @@ mod iron_golem_push_tests {
|
||||
}
|
||||
}
|
||||
});
|
||||
assert!(ran, "the test world needs the prepared data");
|
||||
hits
|
||||
ran.then_some(hits)
|
||||
};
|
||||
let Some(zombie) = hits(mob(2, Species::Zombie, "monster")) else {
|
||||
return;
|
||||
};
|
||||
assert!(
|
||||
hits(mob(2, Species::Zombie, "monster")) > 0,
|
||||
zombie > 0,
|
||||
"a zombie that bumps the golem is taken as its target"
|
||||
);
|
||||
assert_eq!(
|
||||
hits(mob(3, Species::Creeper, "monster")),
|
||||
0,
|
||||
Some(0),
|
||||
"IronGolem.doPush never targets a creeper"
|
||||
);
|
||||
assert_eq!(
|
||||
hits(mob(4, Species::Cow, "creature")),
|
||||
0,
|
||||
Some(0),
|
||||
"a pushed animal is not an Enemy"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user