Skip to main content

Crate test_buffer

Crate test_buffer 

Source
Expand description

A string buffer, print content when test has panicked.

§Examples

#[test]
fn some_test() {
    let mut s = TestBuffer::new();
    writeln!(s, "foo");
    writeln!(s, "bar");
    panic!();
    writeln!(s, "baz");
}

Outputs:

---- some_test stdout ----

thread 'some_test' (15399) panicked at src/lib.rs:120:5:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
===> TestBuffer <unnamed> content preview in panicking <===
foo
bar

§Features

  • expect-test : can using .expect(expect![]) etc

Modules§

test_utils

Structs§

TestBuffer
Buffer used for testing, output buffer name and content during panic