Skip to content

Instantly share code, notes, and snippets.

View maxday's full-sized avatar
🦀

Maxime David maxday

🦀
View GitHub Profile
@maxday
maxday / how-to-test-println.rs
Created November 22, 2022 20:56
[RUST] How to test println?
// ❌ not testable
fn greeting_hard_to_test(nb: i32, name: &str) {
for _ in 0..nb {
println!("hi {}", name);
}
}
// ✅ easy to test
trait Logger {
fn log(&mut self, value: String);