Can we capture println! by std only?

⚓ Rust    📅 2025-09-30    👤 surdeus    👁️ 6      

surdeus

Example

fn func_need_capture(){
println("hello")
}

Can I capture stdout for this test

#[test]
fn capture_test(){
.... //some code here
assert_eq(func_need_capture(),"hello"); // This's what I want to do
}

1 post - 1 participant

Read full topic

🏷️ Rust_feed