use kxio::{kxprintln, print::Printer}; // Example using kxprintln macro fn greet(printer: &Printer, name: &str) { kxprintln!(printer, "Hello, {}!", name); } fn main() { // Production code example let printer = Printer::standard(); kxprintln!(printer, "Macro says: Hello, {}!", "Carol"); greet(&printer, "Carol"); } #[cfg(test)] mod test { use super::*; use kxio::print::TestPrint; #[test] fn test_printer() { // Test code let printer = Printer::test(); // Get reference to TestPrinter so we can make assertions let test_print = printer.as_test().unwrap(); greet(&printer, "Bob"); assert_eq!(test_print.output(), "Hello, Bob!\n"); test_print.clear(); greet(&printer, "Dave"); assert_eq!(test_print.output(), "Hello, Dave!\n"); } }