diff options
| author | mat <github@matdoes.dev> | 2022-04-18 19:45:32 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-18 19:45:32 -0500 |
| commit | 78e692efc3fffc939f1b5af02e3cf32ca5302265 (patch) | |
| tree | 1f8de5d1b907f107f1cfbe571536723caf24e71b /azalea-brigadier/src/lib.rs | |
| parent | b8ceb56e7141320d5ba23a946fe3eceee43f51f5 (diff) | |
| download | azalea-drasl-78e692efc3fffc939f1b5af02e3cf32ca5302265.tar.xz | |
move tests into tests directory
Diffstat (limited to 'azalea-brigadier/src/lib.rs')
| -rw-r--r-- | azalea-brigadier/src/lib.rs | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/azalea-brigadier/src/lib.rs b/azalea-brigadier/src/lib.rs index db46d46e..a294eb19 100644 --- a/azalea-brigadier/src/lib.rs +++ b/azalea-brigadier/src/lib.rs @@ -8,51 +8,3 @@ pub mod modifier; pub mod parse_results; pub mod string_reader; pub mod tree; - -#[cfg(test)] -mod tests { - - use std::rc::Rc; - - use crate::{ - arguments::integer_argument_type::{get_integer, integer}, - builder::{literal_argument_builder::literal, required_argument_builder::argument}, - command_dispatcher::CommandDispatcher, - context::CommandContext, - }; - - struct CommandSourceStack { - player: String, - } - - #[test] - fn it_works() { - let mut dispatcher = CommandDispatcher::new(); - - let source = Rc::new(CommandSourceStack { - player: "player".to_string(), - }); - - dispatcher.register( - literal("foo") - .then(argument("bar", integer()).executes( - |c: &CommandContext<CommandSourceStack>| { - println!( - "Bar is {:?} and player is {}", - get_integer(c, "bar"), - c.source.player - ); - 2 - }, - )) - .executes(|_| { - println!("Called foo with no arguments"); - 1 - }), - ); - - let parse = dispatcher.parse("foo 123".into(), source.clone()); - assert_eq!(CommandDispatcher::<_>::execute_parsed(parse).unwrap(), 2); - assert_eq!(dispatcher.execute("foo".into(), source).unwrap(), 1); - } -} |
