Skip to content
New issue

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

glob!() that matches no files counts as a success #151

Closed
tornewuff opened this issue Jan 2, 2021 · 1 comment · Fixed by #152
Closed

glob!() that matches no files counts as a success #151

tornewuff opened this issue Jan 2, 2021 · 1 comment · Fixed by #152

Comments

@tornewuff
Copy link

Description

The glob!() macro doesn't raise any kind of objection if the glob matches no files; it just runs the closure zero times. This seems unlikely to be intended in test code.

Reproduction steps

#[test]
fn glob_fails() {
    insta::glob!("nonexistent", |_| { panic!(); });
}

Additional helpful information:

  • Version of insta: 1.4.0
  • Version of rustc: 1.48.0
  • Operating system and version: Debian bullssye

What did you expect

I would expect an assert!() that the glob matched at least one file, to guard against incorrect globs in tests.

@tornewuff
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant