Re: [PATCH 1/1] tests: replace `test -(d|f)` with test_path_is_(dir|file)
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 26, 2019, 19:52 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1902262051080.41@tvgsbejvaqbjf.bet>
- In-Reply-To
- <CAL7ArXoau1ZfBsV9JaUDprwjSijyo6K5d9JyC1mdfc=KEvgJxw@mail.gmail.com>
Hi,
On Tue, 26 Feb 2019, Rohit Ashiwal wrote:
Show 22 quoted lines
> Hi Martin > > On Tue, Feb 26, 2019 at 10:01 PM Martin Ågren <martin.agren@gmail.com> 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