We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For example, I want to test all formats from kaitai-struct gallery. I use following code (folder formats is git checkout of https://github.com/kaitai-io/kaitai_struct_formats repository):
formats
#[cfg(test)] mod formats { use std::fs::File; use test_generator::test_resources; use super::Ksy; #[test_resources("formats/**/*.ksy")] fn parse(resource: &str) { let file = File::open(resource).expect(&format!("can't read file {}", resource)); let _: Ksy = serde_yaml::from_reader(file).expect(&format!("invalid file {}", resource)); } }
and get following output:
test parser::formats::parse_formats_archive_cpio_old_le_ksy ... ok ...
Generated function name seems repeat module name. I would be like see something like
test parser::formats::parse_archive_cpio_old_le_ksy ... ok ...
That can be implemented, for example, by introducing capture group in glob pattern, something like #[test_resources("formats/(**/*).ksy")]
#[test_resources("formats/(**/*).ksy")]
The text was updated successfully, but these errors were encountered:
Would be a grood improvement, I like this idea :)
Sorry, something went wrong.
+1 to this idea, for an example of a similar crate that allows customization like this you could look at test_case
Their generate tests are actually #[cfg(test)] modules, e.g. this code
#[cfg(test)]
#[test_case(1; "my test 1")] #[test_case(2; "my test 2")] fn do_test(x: usize) {}
would generate something like
#[cfg(test)] mod do_test { fn do_test(x: usize) {} #[test] fn my_test_1() {do_test(1);} #[test] fn my_test_2() {do_test(2);} }
Personally I'm a fan of this model as it logically groups related tests into a proper module structure.
No branches or pull requests
For example, I want to test all formats from kaitai-struct gallery. I use following code (folder
formats
is git checkout of https://github.com/kaitai-io/kaitai_struct_formats repository):and get following output:
Generated function name seems repeat module name. I would be like see something like
That can be implemented, for example, by introducing capture group in glob pattern, something like
#[test_resources("formats/(**/*).ksy")]
The text was updated successfully, but these errors were encountered: