Added documentation.

This commit is contained in:
Micheal Smith
2025-11-22 06:20:56 -06:00
parent 17b087e618
commit b46a03c13e
10 changed files with 163 additions and 77 deletions

View File

@@ -41,12 +41,12 @@ echo "Weather for $1: Sunny, 72°F"
);
let cmd_dir = CommandDir::new(temp.path());
let message = "!weather 73135";
let message = "!weather 10096";
// Parse the message
let (command_name, arg) = parse_bot_message(message).unwrap();
assert_eq!(command_name, "weather");
assert_eq!(arg, "73135");
assert_eq!(arg, "10096");
// Find and run the command
let result = cmd_dir.run_command(command_name, arg).await;
@@ -54,7 +54,7 @@ echo "Weather for $1: Sunny, 72°F"
assert!(result.is_ok());
let bytes = result.unwrap();
let output = String::from_utf8_lossy(&bytes);
assert!(output.contains("Weather for 73135"));
assert!(output.contains("Weather for 10096"));
assert!(output.contains("Sunny"));
}
@@ -253,7 +253,7 @@ echo "Why did the robot go on vacation? To recharge!"
#[tokio::test]
async fn test_non_bot_message_ignored() {
// Messages not starting with ! should be ignored
let messages = ["hello world", "weather 73135", "?help", "/command", ""];
let messages = ["hello world", "weather 10096", "?help", "/command", ""];
for message in messages {
assert!(