You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a novice insta user, I wrote this in my unit test:
glob!("../tests/fixtures/*.pbf", |file| { ... });
resulting in unhelpful the glob! macro did not match any files error. I tried a few different paths to no help because I was not even sure where the base is, until I simply modified my .cargo/registry/src/index.crates.io-.../insta-1.31.0/src/glob.rs (eek!) with a few extra debug statements:
eprintln!("manifest_dir={manifest_dir}");eprintln!("base={}", base.display());eprintln!("pattern={pattern}");panic!("the glob! macro did not match any files.");
and realized that the base is what I expected it to be, and that I should be using 3 parameter glob! macro:
To make dev's life easier with this amazing (!!!!) tool, I recommend two things:
if the glob! is used with two parameters AND the filter begins with a / or a .., warn or even fail to compile -- because I suspect it is never correct(?), and explain that a 3 param glob! should be used. (i wonder if its possible to make it work in a more intelligent way?)
when printing an error, report where the base was and how it was searched to simplify debugging
Once again, thanks for an awesome tool!
The text was updated successfully, but these errors were encountered:
So I think that ../ can make sense in some cases. I agree that this error is not helpful at all. I think I can try a variation of the proposal to show where the base is and what was searched in the output.
As a novice
insta
user, I wrote this in my unit test:resulting in unhelpful
the glob! macro did not match any files
error. I tried a few different paths to no help because I was not even sure where the base is, until I simply modified my.cargo/registry/src/index.crates.io-.../insta-1.31.0/src/glob.rs
(eek!) with a few extra debug statements:and realized that the base is what I expected it to be, and that I should be using 3 parameter
glob!
macro:Sugestion
To make dev's life easier with this amazing (!!!!) tool, I recommend two things:
glob!
is used with two parameters AND the filter begins with a/
or a..
, warn or even fail to compile -- because I suspect it is never correct(?), and explain that a 3 param glob! should be used. (i wonder if its possible to make it work in a more intelligent way?)Once again, thanks for an awesome tool!
The text was updated successfully, but these errors were encountered: