tap-harness

Crates.iotap-harness
lib.rstap-harness
version0.3.0
sourcesrc
created_at2023-04-18 17:26:04.643681
updated_at2023-10-18 00:24:56.042262
descriptionA Test-Anything-Protocol library
homepage
repositoryhttps://github.com/candlecorp/wick
max_upload_size
id842644
size21,971
Jarrod Overson (jsoverson)

documentation

README

tap-harness

This library is a wrapper to write tests that generate output in the Test Anything Protocol (TAP) format.

Usage

use tap_harness::{TestBlock, TestRunner};

fn main() -> anyhow::Result<()> {
  let mut runner = TestRunner::new(Some("My test"));

  let mut block = TestBlock::new(Some("My block"));

  block.add_test(
    || 3 > 2,
    "three is greater than two",
    Some(vec!["three was not greater".to_owned()]),
  );

  block.add_test(
    || 3 < 2,
    "three is less than two",
    Some(vec!["three was not less than two".to_owned()]),
  );

  runner.add_block(block);

  runner.run();

  let lines = runner.get_tap_lines();

  // or

  runner.print();

  Ok(())
}

This prints:

# My test
1..2
# My block
ok 1 three is greater than two
not ok 2 three is less than two
# three was not less than two

Additional links

Commit count: 948

cargo fmt