[PATCH] test: add tests wrt ignoring user-specified files and directories
Pieter Praet
pieter at praet.org
Sun Feb 19 12:43:56 PST 2012
On Fri, 03 Feb 2012 17:44:55 -0500, Austin Clements <amdragon at MIT.EDU> wrote:
> On Wed, 1 Feb 2012 15:12:53 +0100, Pieter Praet <pieter at praet.org> wrote:
> > Files and directories which are specified in 'new.ignore' in the
> > config file shouldn't be indexed nor reported by `notmuch new'.
> >
> > ---
> > test/new | 23 +++++++++++++++++++++++
> > 1 files changed, 23 insertions(+), 0 deletions(-)
> >
> > diff --git a/test/new b/test/new
> > index 49f390d..740ba05 100755
> > --- a/test/new
> > +++ b/test/new
> > @@ -153,4 +153,27 @@ rm -rf "${MAIL_DIR}"/two
> > output=$(NOTMUCH_NEW)
> > test_expect_equal "$output" "No new mail. Removed 3 messages."
> >
> > +test_begin_subtest "Skip and report non-mail files"
> > +generate_message
> > +mkdir -p "${MAIL_DIR}"/.git && touch "${MAIL_DIR}"/.git/config
> > +touch "${MAIL_DIR}"/ignored_file
> > +touch "${MAIL_DIR}"/.ignored_hidden_file
> > +output=$(NOTMUCH_NEW 2>&1)
> > +test_expect_equal "$output" \
> > +"Note: Ignoring non-mail file: ${MAIL_DIR}/.git/config
> > +Note: Ignoring non-mail file: ${MAIL_DIR}/.ignored_hidden_file
> > +Note: Ignoring non-mail file: ${MAIL_DIR}/ignored_file
> > +Added 1 new message to the database."
> > +
> > +test_begin_subtest "Ignore files and directories specified in new.ignore"
> > +test_subtest_known_broken
> > +generate_message
> > +notmuch config set new.ignore .git ignored_file .ignored_hidden_file
> > +mkdir -p "${MAIL_DIR}"/.git && touch "${MAIL_DIR}"/.git/config
>
> This doesn't change .git's mtime, so notmuch new may not scan it (*may*
> not because it's possible/likely notmuch refused to record the mtime in
> the above test on account of lack of granularity). Probably you should
> just touch "${MAIL_DIR}"/.git. Or maybe touch a new file under it.
>
Good point.
> > +touch "${MAIL_DIR}"/ignored_file
> > +touch "${MAIL_DIR}"/.ignored_hidden_file
>
> These aren't necessary since these files already exist and they won't
> touch the directory's mtime (though the generate_message will).
>
Those are/were intended to keep the test self-contained (i.e.
independent of the previous one). Probably should've added a
comment about that.
> > +output=$(NOTMUCH_NEW 2>&1)
> > +test_expect_equal "$output" "Added 1 new message to the database."
> > +
> > +
> > test_done
> > --
> > 1.7.8.1
> >
> > _______________________________________________
> > notmuch mailing list
> > notmuch at notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch
> >
Thanks for reviewing!
Peace
--
Pieter
More information about the notmuch
mailing list