From 78e692efc3fffc939f1b5af02e3cf32ca5302265 Mon Sep 17 00:00:00 2001 From: mat Date: Mon, 18 Apr 2022 19:45:32 -0500 Subject: move tests into tests directory --- azalea-brigadier/src/lib.rs | 48 --------------------------------------------- 1 file changed, 48 deletions(-) (limited to 'azalea-brigadier/src/lib.rs') 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| { - 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); - } -} -- cgit v1.2.3