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 macro gives bad error message for parent dirs #623

Open
max-sixty opened this issue Sep 27, 2024 · 0 comments
Open

glob macro gives bad error message for parent dirs #623

max-sixty opened this issue Sep 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@max-sixty
Copy link
Collaborator

What happened?

This panics on not finding files:

#[test]
fn test_glob_path() {

    insta::glob!("../**/*.rs", |path| {
        let input = std::fs::read_to_string(path).unwrap();
        insta::assert_snapshot!(input);
    })

}
failures:

---- test_glob_path stdout ----
thread 'test_glob_path' panicked at /Users/maximilian/workspace/insta/insta/src/glob.rs:112:9:
the glob! macro did not match any files.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Reproduction steps

As above

Insta Version

1.40

rustc Version

1.80

What did you expect?

At the least we should give an error message saying parent paths aren't supported.

Should we allow this or is it a security risk? @mitsuhiko ?

It's not doing anything that rust can't do ofc. But perhaps we want insta tests to be safe?

@max-sixty max-sixty added the bug Something isn't working label Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant