#testing #path #glob-pattern

fixtures

对fixture文件运行测试

1个不稳定版本

0.1.0 2023年9月17日

#2091 in 过程宏

Download history 13/week @ 2024-05-19 37/week @ 2024-05-26 1/week @ 2024-06-02 8/week @ 2024-06-09 14/week @ 2024-06-16 87/week @ 2024-06-23 12/week @ 2024-06-30 1/week @ 2024-07-07 24/week @ 2024-07-14 38/week @ 2024-07-21 98/week @ 2024-07-28

每月161次下载

MIT许可证

5KB
73

fixtures

fixtures是一个Rust crate,允许开发者对fixture文件运行测试。

#[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
  }
}

上面的示例展开为

#[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"));
  }

  // ...
}

依赖项

~0.4–0.8MB
~19K SLoC