Remove code comments

This commit is contained in:
Jean Chevronnet 2026-07-29 16:24:30 +00:00
parent a5e58493d8
commit 52d7c13013
17 changed files with 18 additions and 335 deletions

View file

@ -1,7 +1,3 @@
//! Unit tests for feature modules — constructed directly and driven through the
//! public `Module` trait, with no network. This is the payoff of the module
//! system: features are testable in isolation.
use rustbot::bot::module::{Action, Command, Module};
use rustbot::bot::modules::{builtins::Builtins, dice::Dice};
@ -9,7 +5,6 @@ fn cmd<'a>(name: &'a str, args: &'a [&'a str]) -> Command<'a> {
Command { sender: "alice", reply_to: "#chan", name, args, prefix: ">", network: "test" }
}
/// Assert the module produced exactly one reply and return its text.
fn reply(actions: &[Action]) -> &str {
match actions {
[Action::Reply(s)] => s,
@ -47,7 +42,6 @@ fn dice_2d6_total_is_in_range() {
let mut d = Dice::new();
for _ in 0..300 {
let r = reply(&d.on_command(&cmd("roll", &["2d6"]))).to_string();
// Format: "2d6: a + b = total"
let total: u64 = r.rsplit('=').next().unwrap().trim().parse().unwrap();
assert!((2..=12).contains(&total), "2d6 total {total} out of range: {r:?}");
}
@ -57,7 +51,6 @@ fn dice_2d6_total_is_in_range() {
fn dice_defaults_to_1d6() {
let mut d = Dice::new();
let r = reply(&d.on_command(&cmd("roll", &[]))).to_string();
// Format: "1d6: N"
assert!(r.starts_with("1d6: "), "unexpected format: {r:?}");
let n: u64 = r.rsplit(':').next().unwrap().trim().parse().unwrap();
assert!((1..=6).contains(&n), "1d6 {n} out of range: {r:?}");
@ -81,7 +74,6 @@ fn dice_rejects_garbage_with_usage() {
#[test]
fn dice_rejects_out_of_bounds() {
let mut d = Dice::new();
// 999 dice exceeds the cap; 1-sided die is below the minimum.
assert!(reply(&d.on_command(&cmd("roll", &["999d6"]))).contains("usage"));
assert!(reply(&d.on_command(&cmd("roll", &["1d1"]))).contains("usage"));
}