Skip to content

Commit 01bfd04

Browse files
committed
fixing tests
1 parent e0ef145 commit 01bfd04

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

src/inventory_system.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,11 @@ mod tests {
468468
let player_entity = get_player_unwrap(&gs.ecs, PLAYER_NAME);
469469
let player_posn = get_player_pos_unwrap(&gs.ecs, PLAYER_NAME);
470470

471-
spawner::iron_dagger(&mut gs.ecs, player_posn);
471+
spawner::dagger_at_level(5, &mut gs.ecs, player_posn);
472472
get_item(&mut gs.ecs); // pickup an item
473473
gs.run_systems();
474474

475-
spawner::iron_shield(&mut gs.ecs, player_posn);
475+
spawner::dagger_at_level(5, &mut gs.ecs, player_posn);
476476
get_item(&mut gs.ecs); // pickup an item
477477
gs.run_systems();
478478

@@ -493,17 +493,17 @@ mod tests {
493493
let player_entity = get_player_unwrap(&gs.ecs, PLAYER_NAME);
494494
let player_posn = get_player_pos_unwrap(&gs.ecs, PLAYER_NAME);
495495

496-
let _dagger1 = spawner::iron_dagger(&mut gs.ecs, player_posn);
496+
let _dagger1 = spawner::dagger_at_level(1, &mut gs.ecs, player_posn);
497497
get_item(&mut gs.ecs); // pickup an item
498498
gs.run_systems();
499499
use_first_backpack_item(&mut gs, player_entity);
500500

501-
let shield = spawner::iron_shield(&mut gs.ecs, player_posn);
501+
let shield = spawner::shield_at_level(1, &mut gs.ecs, player_posn);
502502
get_item(&mut gs.ecs); // pickup an item
503503
gs.run_systems();
504504
use_first_backpack_item(&mut gs, player_entity);
505505

506-
let dagger2 = spawner::iron_dagger(&mut gs.ecs, player_posn);
506+
let dagger2 = spawner::dagger_at_level(1, &mut gs.ecs, player_posn);
507507
get_item(&mut gs.ecs); // pickup an item
508508
gs.run_systems();
509509

src/spawner.rs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ pub fn random_shield_material(rng: &mut RandomNumberGenerator, map_depth: i32) -
197197
mat_table.roll(rng)
198198
}
199199

200-
fn shield_at_level(map_depth: i32, ecs: &mut World, pos: Position) -> Entity {
200+
pub fn shield_at_level(map_depth: i32, ecs: &mut World, pos: Position) -> Entity {
201201
let (shield_material, shield_quality) = {
202202
let rng = &mut ecs.write_resource::<RandomNumberGenerator>();
203203
(
@@ -552,13 +552,3 @@ pub fn spawn_in_room(
552552
})
553553
.collect()
554554
}
555-
556-
#[cfg(test)]
557-
mod tests {
558-
use super::health_potion_tuple_test;
559-
560-
// compile-time test
561-
fn test_cloneable_fn() {
562-
let _cloned_health_potion_tuple_test = health_potion_tuple_test.clone();
563-
}
564-
}

0 commit comments

Comments
 (0)