From 12cc6b7b58385e3934a042fae90b7e844d3662f2 Mon Sep 17 00:00:00 2001 From: MrlnHi Date: Sun, 23 Apr 2023 01:24:03 +0200 Subject: [PATCH] Fix unit tests --- crates/valence_schem/Cargo.toml | 3 +++ crates/valence_schem/src/lib.rs | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/crates/valence_schem/Cargo.toml b/crates/valence_schem/Cargo.toml index 2d43c7098..3c7df536b 100644 --- a/crates/valence_schem/Cargo.toml +++ b/crates/valence_schem/Cargo.toml @@ -18,3 +18,6 @@ valence_block.workspace = true valence_core.workspace = true valence_instance.workspace = true valence_nbt.workspace = true + +[dev-dependencies] +valence.workspace = true diff --git a/crates/valence_schem/src/lib.rs b/crates/valence_schem/src/lib.rs index 9e748538b..b8859bba3 100644 --- a/crates/valence_schem/src/lib.rs +++ b/crates/valence_schem/src/lib.rs @@ -957,16 +957,16 @@ impl Schematic { mod test { use std::fs; + use valence::prelude::*; + use valence_core::ident; + use super::*; #[test] fn schematic_copy_paste() { let mut app = App::new(); - app.add_plugin(ServerPlugin::new(())); - let mut instance = app - .world - .resource::() - .new_instance(DimensionId::default()); + app.add_plugins(DefaultPlugins); + let mut instance = Instance::new_unit_testing(ident!("overworld"), app.world.resource()); for x in -1..=0 { for z in -1..=0 { @@ -981,7 +981,7 @@ mod test { instance.set_block([6, 2, -1], BlockState::STONE); instance.set_block( [5, 3, -1], - Block::with_nbt( + ValenceBlock::with_nbt( BlockState::OAK_SIGN, compound! {"Text1" => "abc".into_text()}, ), @@ -997,7 +997,7 @@ mod test { &instance, (BlockPos::new(4, 3, -1), BlockPos::new(6, 1, 0)), BlockPos::new(5, 3, 0), - |_| ident!("minecraft:plains"), + |_| ident!("minecraft:plains").to_string_ident(), ); schematic.paste(&mut instance, BlockPos::new(15, 18, 16), |_| { @@ -1068,7 +1068,7 @@ mod test { "Data" => compound!{ "Text1" => "abc".into_text(), }, - "Id" => "sign", + "Id" => "minecraft:sign", "Pos" => vec![1, 2, 0], }, ]))