<feed xmlns='http://www.w3.org/2005/Atom'>
<title>notmuch/test/test-lib.sh, branch 0.14</title>
<subtitle>thread-based email index, search, and tagging</subtitle>
<id>https://git.notmuchmail.org/git/notmuch/atom?h=0.14</id>
<link rel='self' href='https://git.notmuchmail.org/git/notmuch/atom?h=0.14'/>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/'/>
<updated>2012-08-03T23:14:47Z</updated>
<entry>
<title>test: Uniformly canonicalize actual and expected JSON</title>
<updated>2012-08-03T23:14:47Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@MIT.EDU</email>
</author>
<published>2012-08-03T01:14:47Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=a34bb1f9fad7c547eec5c254ce8274f190491186'/>
<id>urn:sha1:a34bb1f9fad7c547eec5c254ce8274f190491186</id>
<content type='text'>
Previously, we used a variety of ad-hoc canonicalizations for JSON
output in the test suite, but were ultimately very sensitive to JSON
irrelevancies such as whitespace.  This introduces a new test
comparison function, test_expect_equal_json, that first pretty-prints
*both* the actual and expected JSON and the compares the result.

The current implementation of this simply uses Python's json.tool to
perform pretty-printing (with a fallback to the identity function if
parsing fails).  However, since the interface it introduces is
semantically high-level, we could swap in other mechanisms in the
future, such as another pretty-printer or something that does not
re-order object keys (if we decide that we care about that).

In general, this patch does not remove the existing ad-hoc
canonicalization because it does no harm.  We do have to remove the
newline-after-comma rule from notmuch_json_show_sanitize and
filter_show_json because it results in invalid JSON that cannot be
pretty-printed.

Most of this patch simply replaces test_expect_equal and
test_expect_equal_file with test_expect_equal_json.  It changes the
expected JSON in a few places where sanitizers had placed newlines
after commas inside strings.
</content>
</entry>
<entry>
<title>test: use subtest name for generated message subject by default</title>
<updated>2012-03-18T12:14:22Z</updated>
<author>
<name>Dmitry Kurochkin</name>
<email>dmitry.kurochkin@gmail.com</email>
</author>
<published>2012-03-10T01:24:51Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=db97cb5b65dc519d2bd02741a6294fdb7dd74459'/>
<id>urn:sha1:db97cb5b65dc519d2bd02741a6294fdb7dd74459</id>
<content type='text'>
Before the change, messages generated by generate_message() used "Test
message #N" for default subject where N is the generated messages
counter.  Since message subject is commonly present in expected
results, there is a chance of breaking other tests when a new
generate_message() call is added.  The patch changes default subject
value for generated messages to subtest name if it is available.  If
subtest name is not available (i.e. message is generated during test
initialization), the old default value is used (in this case it is
fine to have the counter in the subject).

Another benefit of this change is a sane default value for subject in
generated messages, which would allow to simplify code like:

  test_begin_subtest "test for a cool feature"
  add_message [subject]="message for test for a cool feature"
</content>
</entry>
<entry>
<title>test: Add test for searching of uncommonly encoded messages</title>
<updated>2012-02-29T11:34:54Z</updated>
<author>
<name>Michal Sojka</name>
<email>sojkam1@fel.cvut.cz</email>
</author>
<published>2012-02-24T00:33:15Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=74f8f15adc1e6fce2d3fcc34b7e9ef0b65d926db'/>
<id>urn:sha1:74f8f15adc1e6fce2d3fcc34b7e9ef0b65d926db</id>
<content type='text'>
Emails that are encoded differently than as ASCII or UTF-8 are not
indexed properly by notmuch. It is not possible to search for non-ASCII
words within those messages.
</content>
</entry>
<entry>
<title>test: always report missing prereqs, independent of `--verbose' option</title>
<updated>2012-02-21T03:24:20Z</updated>
<author>
<name>Pieter Praet</name>
<email>pieter@praet.org</email>
</author>
<published>2012-01-18T12:19:41Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=e3fb62f59b7cf93c818f382a62c37eea2d1b4f74'/>
<id>urn:sha1:e3fb62f59b7cf93c818f382a62c37eea2d1b4f74</id>
<content type='text'>
When tests are skipped due to missing prereqs, those prereqs are only
displayed when running with the `--verbose' option.  This is essential
information when troubleshooting, so always send to stdout.
</content>
</entry>
<entry>
<title>test: auto load elisp tests file in test_emacs if available</title>
<updated>2012-02-12T16:58:20Z</updated>
<author>
<name>Dmitry Kurochkin</name>
<email>dmitry.kurochkin@gmail.com</email>
</author>
<published>2012-01-29T03:36:02Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=754ddbb578175b986b10099cb4a11517080579f7'/>
<id>urn:sha1:754ddbb578175b986b10099cb4a11517080579f7</id>
<content type='text'>
This allows us to simplify shell part of tests written in elisp.
</content>
</entry>
<entry>
<title>test: Add `test_emacs_expect_t'.</title>
<updated>2012-01-25T11:25:44Z</updated>
<author>
<name>David Edmondson</name>
<email>dme@dme.org</email>
</author>
<published>2012-01-24T16:14:05Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=260975e8aff635b6b99db835ee8d40ec33ee916c'/>
<id>urn:sha1:260975e8aff635b6b99db835ee8d40ec33ee916c</id>
<content type='text'>
Add a new test function to allow simpler testing of emacs
functionality.

`test_emacs_expect_t' takes one argument - a lisp expression to
evaluate. The test passes if the expression returns `t', otherwise it
fails and the output is reported to the tester.
</content>
</entry>
<entry>
<title>test: Don't return the result of checking for running emacs to the tester.</title>
<updated>2012-01-25T11:25:25Z</updated>
<author>
<name>David Edmondson</name>
<email>dme@dme.org</email>
</author>
<published>2012-01-24T16:14:04Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=2903b32f79dcf7789a2b015c48194cb40ac71462'/>
<id>urn:sha1:2903b32f79dcf7789a2b015c48194cb40ac71462</id>
<content type='text'>
When checking for a running emacs, test_emacs evaluates the empty list
'()'. This returns 'nil' when emacs is running, which is then
prepended to the actual test result. Given that it is not part of the
actual test output the test harness can incorrectly report test
failure (or success).
</content>
</entry>
<entry>
<title>test: whitespace-cleanup for most test/* files</title>
<updated>2012-01-22T13:12:12Z</updated>
<author>
<name>Tomi Ollila</name>
<email>tomi.ollila@iki.fi</email>
</author>
<published>2012-01-11T16:53:59Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=da9f39216555934327a91ebc6b3b726b0a989dcf'/>
<id>urn:sha1:da9f39216555934327a91ebc6b3b726b0a989dcf</id>
<content type='text'>
Used emacs (whitespace-cleanup) function to "cleanup blank problems"
in test files where that could be done without breaking tests;
test/emacs was partially, and test/multipart was fully reverted.
</content>
</entry>
<entry>
<title>test: don't bail out of `run_emacs' too early when missing prereqs</title>
<updated>2012-01-16T02:37:07Z</updated>
<author>
<name>Pieter Praet</name>
<email>pieter@praet.org</email>
</author>
<published>2012-01-14T09:09:37Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=42e8f66edf91095bb87b3ee7713b94002ffd3edc'/>
<id>urn:sha1:42e8f66edf91095bb87b3ee7713b94002ffd3edc</id>
<content type='text'>
When running the Emacs tests in verbose mode, only the first missing
prereq is reported because the `run_emacs' function is short-circuited
early:

  #+begin_example
    emacs: Testing emacs interface
     missing prerequisites: [0]  emacs(1)
     skipping test: [0]  Basic notmuch-hello view in emacs
     SKIP   [0]  Basic notmuch-hello view in emacs
  #+end_example

This can lead to situations reminiscent of "dependency hell", so instead
of returning based on each individual `test_require_external_prereq's exit
status, we now do so only after checking all the prereqs:

  #+begin_example
    emacs: Testing emacs interface
     missing prerequisites: [0]  dtach(1) emacs(1) emacsclient(1)
     skipping test: [0]  Basic notmuch-hello view in emacs
     SKIP   [0]  Basic notmuch-hello view in emacs
  #+end_example

Also added missing prereq for dtach(1).
</content>
</entry>
<entry>
<title>test: Remove #! line from test-lib.sh</title>
<updated>2011-12-29T22:03:00Z</updated>
<author>
<name>Austin Clements</name>
<email>amdragon@MIT.EDU</email>
</author>
<published>2011-12-29T02:34:56Z</published>
<link rel='alternate' type='text/html' href='https://git.notmuchmail.org/git/notmuch/commit/?id=f4996c3f04e3c975edb3b2171cbce78002ae628d'/>
<id>urn:sha1:f4996c3f04e3c975edb3b2171cbce78002ae628d</id>
<content type='text'>
It makes no sense to run test-lib.sh, so it makes no sense to give it
an interpreter.  This is particularly annoying for Emacs users who
have executable-insert set, since the presence of the #! line will
cause Emacs to mark test-lib.sh executable when saving it, which will
in turn case the 'basic' test to fail.
</content>
</entry>
</feed>
