Format with rustfmt
All checks were successful
ci / check (push) Successful in 44s

This commit is contained in:
Jean Chevronnet 2026-07-29 19:17:16 +00:00
parent facbde55bd
commit 7846f91afe
No known key found for this signature in database
GPG key ID: 439666D63A9477E4
11 changed files with 209 additions and 54 deletions

View file

@ -2,7 +2,14 @@ use rustbot::bot::module::{Action, Command, Module};
use rustbot::bot::modules::{builtins::Builtins, dice::Dice};
fn cmd<'a>(name: &'a str, args: &'a [&'a str]) -> Command<'a> {
Command { sender: "alice", reply_to: "#chan", name, args, prefix: ">", network: "test" }
Command {
sender: "alice",
reply_to: "#chan",
name,
args,
prefix: ">",
network: "test",
}
}
fn reply(actions: &[Action]) -> &str {
@ -21,7 +28,10 @@ fn builtins_ping_pongs() {
#[test]
fn builtins_echo_joins_args() {
let mut m = Builtins;
assert_eq!(reply(&m.on_command(&cmd("echo", &["hello", "world"]))), "hello world");
assert_eq!(
reply(&m.on_command(&cmd("echo", &["hello", "world"]))),
"hello world"
);
}
#[test]
@ -43,7 +53,10 @@ fn dice_2d6_total_is_in_range() {
for _ in 0..300 {
let r = reply(&d.on_command(&cmd("roll", &["2d6"]))).to_string();
let total: u64 = r.rsplit('=').next().unwrap().trim().parse().unwrap();
assert!((2..=12).contains(&total), "2d6 total {total} out of range: {r:?}");
assert!(
(2..=12).contains(&total),
"2d6 total {total} out of range: {r:?}"
);
}
}