#testing #utility-macro #results #series #outputting #cargo

test-results

A series of utility macros for outputting testing results

3 releases

0.1.2 Sep 1, 2022
0.1.1 Jan 27, 2022
0.1.0 Jan 27, 2022

#2336 in Rust patterns

Download history 8/week @ 2024-02-23 5/week @ 2024-03-01 4/week @ 2024-03-15 39/week @ 2024-03-29 45/week @ 2024-04-05 5/week @ 2024-04-12

89 downloads per month

MIT license

8KB
100 lines

test-results

A series of utility macros for outputting testing results.

Getting Started

Simply add the test-results crate to your project's Cargo.toml like this:

[dependencies]
test-results = "0"

macros

save!(name: &str, value: &u8)

Save the value as test results.

example:

#[test]
fn test_hello_world() {
    test_results::save!("output.txt", [0x31, 0x32, 0x33]);
}

Run the test and the file will be saved in the test_results folder in the same directory as the source files.

├─ test.rs
└─ test_results
    └─ output.txt

Optionally, you can add test_results/ to the .gitignore file.

echo 'test_results/' >> .gitignore

lib.rs:

test-results

A series of utility macros for outputting testing results.

macros

save!(name: &str, value: &u8)

Save the value as test results.

example:

#[test]
fn test_hello_world() {
    test_results::save!("output.txt", [0x31, 0x32, 0x33]);
}

Run the test and the file will be saved in the test_results folder in the same directory as the source files.

├─ test.rs
└─ test_results
    └─ output.txt

Optionally, you can add test_results/ to the .gitignore file.

echo 'test_results/' >> .gitignore

Dependencies

~0.7–1.5MB
~34K SLoC