Can we capture println! by std only?

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

surdeus

Warning

This post was published 111 days ago. The information described in this article may have changed.

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