Web lists-archives.com

Re: [PATCH 1/1] tests: replace `test -(d|f)` with test_path_is_(dir|file)




Hi,

On Tue, 26 Feb 2019, Rohit Ashiwal wrote:

> Hi Martin
> 
> On Tue, Feb 26, 2019 at 10:01 PM Martin Ågren <martin.agren@xxxxxxxxx> wrote:
> >
> > > -       ! test -d submod &&
> > > +       ! test_path_is_dir submod &&
> >
> > Now, here I wonder. This (and other changes like this) means that every
> > time the test passes, we see "Directory submod doesn't exist.", which is
> > perhaps not too irritating. But more importantly, when the test fails,
> > we don't get any hint. So a failure is just as silent and "non-helpful"
> > as before. I can think of a few approaches:
> 
> >
> >  1 Teach `test_path_is_dir` and friends to handle "!" in a clever way, and
> >    write these as `test_path_is_dir ! foo`. (We already have helpers
> >    that do this, see, e.g., `test_i18ngrep`.)
> >
> 
> Yes, I also think that it should be corrected and I think this(1)
> approach is good as it resonates well with the existing code. I'll
> start working on it and submit the patch as soon as possible.

We already have `test_path_is_missing`. Why not use that instead of `!
test -d` or `! test -f`?

Ciao,
Johannes