fixtures

Crates.iofixtures
lib.rsfixtures
version0.1.0
sourcesrc
created_at2023-09-17 16:26:32.178834
updated_at2023-09-17 16:26:32.178834
descriptionRun tests against fixtures
homepagehttps://github.com/bcheidemann/fixtures-rs
repositoryhttps://github.com/bcheidemann/fixtures-rs
max_upload_size
id975213
size6,019
Ben Heidemann (bcheidemann)

documentation

README

fixtures

fixtures is a Rust crate which allows developers to run tests against fixture files.

#[cfg(test)]
mod tests {
  use fixtures::fixtures;

  #[fixtures("fixtures/*.txt")]
  fn test(path: &std::path::Path) {
    // This test will be run once for each file matching the glob pattern
  }
}

The above example expands to:

#[cfg(test)]
mod tests {
  use fixtures::fixtures;

  fn test(path: &std::path::Path) {
    // This test will be run once for each file matching the glob pattern
  }

  #[test]
  fn test_one_dot_txt_1() {
    test(::std::path::Path::new("fixtures/one.txt"));
  }

  #[test]
  fn test_two_dot_txt_1() {
    test(::std::path::Path::new("fixtures/two.txt"));
  }

  // ...
}
Commit count: 2

cargo fmt