Skip to content

Commit

Permalink
Update tests to compile and remove warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
azriel91 committed Jul 17, 2021
1 parent 3909ac4 commit 70c0226
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,6 @@ mod test {
setup(invocations, intercepts)
}

#[macro_use]
macro_rules! delegate_test {
($test_name:ident, $function:ident, $invocation:expr) => {
#[test]
Expand All @@ -286,7 +285,6 @@ mod test {
};
}

#[macro_use]
macro_rules! intercept_no_op_test {
($test_name:ident, $function:ident, $($invocation:expr),* $(,)*) => {
#[test]
Expand All @@ -304,7 +302,6 @@ mod test {
}
}

#[macro_use]
macro_rules! intercept_no_op_trans_test {
($test_name:ident, $function:ident, $expected_trans:expr, $($invocation:expr),* $(,)*) => {
#[test]
Expand All @@ -323,7 +320,6 @@ mod test {
}
}

#[macro_use]
macro_rules! intercept_begin_test {
($test_name:ident, $function:ident, $expected_trans:expr, $($invocation:expr),* $(,)*) => {
#[test]
Expand All @@ -342,7 +338,6 @@ mod test {
}
}

#[macro_use]
macro_rules! intercept_end_test {
($test_name:ident, $function:ident, $expected_trans:expr, $($invocation:expr),* $(,)*) => {
#[test]
Expand Down Expand Up @@ -702,7 +697,6 @@ mod test {

/// Declares a function that pushes the specified invocation to the
/// `self.invocations` field.
#[macro_use]
macro_rules! fn_ {
($function:ident, $invocation:expr) => {
fn $function(&mut self, _: StateData<'_, T>) {
Expand All @@ -716,7 +710,6 @@ mod test {
///
/// This macro passes the `self.id` field as a parameter to the `Invocation`
/// variant.
#[macro_use]
macro_rules! fn_id {
($function:ident, $invocation:expr; [$($additional_param:ty),*]) => {
fn $function(&mut self, $(_: $additional_param),*) {
Expand All @@ -732,7 +725,6 @@ mod test {
///
/// The function returns the value in the `self.trans` field, which is
/// expected to contain a value.
#[macro_use]
macro_rules! fn_trans {
($function:ident, $invocation:expr; [$($additional_param:ty),*]) => {
fn $function(&mut self, $(_: $additional_param),*) -> Trans<T, E> {
Expand All @@ -749,7 +741,6 @@ mod test {
/// `self.invocations` field.
///
/// The function returns the optional value in the `self.$trans` field
#[macro_use]
macro_rules! fn_opt_trans {
($function:ident, $invocation:expr, $trans:ident; [$($additional_param:ty),*]) => {
fn $function(&mut self, $(_: $additional_param),*) -> Option<Trans<T, E>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,8 @@ mod test {

assert!(
!object_entities.is_empty(),
// kcov-ignore-start
format!(
// kcov-ignore-end
"Expected at least one entity for the `{}` object type",
object_type
)
"Expected at least one entity for the `{}` object type",
object_type
);
});

Expand Down
36 changes: 12 additions & 24 deletions crate/workspace_tests/src/asset_model/config/asset_slug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ mod tests {
assert_eq!(
Err(AssetSlugBuildError::NoValueProvided {
segment: AssetSlugSegment::Namespace
}
.to_string()),
}),
AssetSlugBuilder::default().build()
);
}
Expand All @@ -20,8 +19,7 @@ mod tests {
assert_eq!(
Err(AssetSlugBuildError::SegmentEmpty {
segment: AssetSlugSegment::Namespace
}
.to_string()),
}),
AssetSlugBuilder::default()
.namespace("".to_string())
.build()
Expand All @@ -34,8 +32,7 @@ mod tests {
Err(AssetSlugBuildError::SegmentContainsControlChar {
segment: AssetSlugSegment::Namespace,
value: String::from("aœb")
}
.to_string()),
}),
AssetSlugBuilder::default()
.namespace("aœb".to_string())
.build()
Expand All @@ -48,8 +45,7 @@ mod tests {
Err(AssetSlugBuildError::SegmentContainsWhitespace {
segment: AssetSlugSegment::Namespace,
value: String::from("a b")
}
.to_string()),
}),
AssetSlugBuilder::default()
.namespace("a b".to_string())
.build()
Expand All @@ -62,8 +58,7 @@ mod tests {
Err(AssetSlugBuildError::SegmentContainsForwardSlash {
segment: AssetSlugSegment::Namespace,
value: String::from("a/b")
}
.to_string()),
}),
AssetSlugBuilder::default()
.namespace("a/b".to_string())
.build()
Expand All @@ -76,8 +71,7 @@ mod tests {
Err(AssetSlugBuildError::SegmentStartsWithNumericChar {
segment: AssetSlugSegment::Namespace,
value: String::from("1ab")
}
.to_string()),
}),
AssetSlugBuilder::default()
.namespace("1ab".to_string())
.build()
Expand All @@ -89,8 +83,7 @@ mod tests {
assert_eq!(
Err(AssetSlugBuildError::NoValueProvided {
segment: AssetSlugSegment::Name
}
.to_string()),
}),
AssetSlugBuilder::default()
.namespace("test".to_string())
.build()
Expand All @@ -102,8 +95,7 @@ mod tests {
assert_eq!(
Err(AssetSlugBuildError::SegmentEmpty {
segment: AssetSlugSegment::Name
}
.to_string()),
}),
AssetSlugBuilder::default()
.namespace("test".to_string())
.name("".to_string())
Expand All @@ -117,8 +109,7 @@ mod tests {
Err(AssetSlugBuildError::SegmentContainsControlChar {
segment: AssetSlugSegment::Name,
value: String::from("aœb")
}
.to_string()),
}),
AssetSlugBuilder::default()
.namespace("test".to_string())
.name("aœb".to_string())
Expand All @@ -132,8 +123,7 @@ mod tests {
Err(AssetSlugBuildError::SegmentContainsWhitespace {
segment: AssetSlugSegment::Name,
value: String::from("a b")
}
.to_string()),
}),
AssetSlugBuilder::default()
.namespace("test".to_string())
.name("a b".to_string())
Expand All @@ -147,8 +137,7 @@ mod tests {
Err(AssetSlugBuildError::SegmentContainsForwardSlash {
segment: AssetSlugSegment::Name,
value: String::from("a/b")
}
.to_string()),
}),
AssetSlugBuilder::default()
.namespace("test".to_string())
.name("a/b".to_string())
Expand All @@ -162,8 +151,7 @@ mod tests {
Err(AssetSlugBuildError::SegmentStartsWithNumericChar {
segment: AssetSlugSegment::Name,
value: String::from("1ab")
}
.to_string()),
}),
AssetSlugBuilder::default()
.namespace("test".to_string())
.name("1ab".to_string())
Expand Down
1 change: 0 additions & 1 deletion crate/workspace_tests/src/debug_util_amethyst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ mod test {

use debug_util_amethyst::{assert_eq_opt_trans, assert_eq_trans};

#[macro_use]
macro_rules! test_opt_trans_panic {
($test_name:ident, $message:expr, $expected:expr, $actual:expr) => {
#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,20 @@ mod tests {

use amethyst::{
assets::{AssetStorage, Loader},
ecs::{Builder, Entity, Read, ReadExpect, World, WorldExt, WriteStorage},
ecs::{Builder, Entity, Read, ReadExpect, World, WorldExt},
input::InputEvent,
shred::{ResourceId, SystemData},
shrev::EventChannel,
winit::event::VirtualKeyCode,
Error,
};
use application::IoUtils;
use application_test_support::AutexousiousApplication;
use derivative::Derivative;
use game_input_model::{config::ControlBindings, play::ButtonInputControlled};
use input_reaction_loading::{IrsLoader, IrsLoaderParams};
use input_reaction_model::{
config::BasicIrr,
loaded::{
InputReaction, InputReactions, InputReactionsHandle, InputReactionsSequence,
InputReactionsSequenceHandle,
InputReaction, InputReactions, InputReactionsSequence, InputReactionsSequenceHandle,
},
};
use sequence_model::{
Expand Down Expand Up @@ -192,17 +189,6 @@ mod tests {
ec.single_write(event);
} // kcov-ignore

#[derive(Derivative, SystemData)]
#[derivative(Debug)]
struct TestSystemData<'s> {
#[derivative(Debug = "ignore")]
sequence_ids: WriteStorage<'s, SequenceId>,
#[derivative(Debug = "ignore")]
input_reactions_handles: WriteStorage<'s, InputReactionsHandle<InputReaction<BasicIrr>>>,
#[derivative(Debug = "ignore")]
button_input_controlleds: WriteStorage<'s, ButtonInputControlled>,
}

struct SetupParams {
sequence_id: SequenceId,
input_event: Option<InputEvent<ControlBindings>>,
Expand Down

0 comments on commit 70c0226

Please sign in to comment.