Commit graph

13 commits

Author SHA1 Message Date
Austin Clements
a34bb1f9fa test: Uniformly canonicalize actual and expected JSON
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.
2012-08-03 20:14:47 -03:00
David Bremner
7da6733e89 test: add two new messages to corpus with iso-8859-1 encoding
One is quoted printable, the other users 8 bit encoding. The latter
triggers a bug in the python bindings due to missing call to
g_mime_init. The corresponding test is marked broken in this commit.
2011-12-31 23:04:01 -04:00
Mark Anderson
c87da6961d test:Expect multiple filenames for message with multiple files
Update the test mail corpus to have two files with the same content to
expose the bug where a single message with multiple filenames only
reports a single filename.

Update expected results for search --output=files to match new
behavior for multiple files corresponding to a single message

Signed-off-by: Mark Anderson <ma.skies@gmail.com>
2011-06-28 12:05:50 -07:00
Austin Clements
c62a0d016f Fix misspelling in search output sanitization test.
A simple spelling fix in the text description.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
2011-06-03 12:30:55 -07:00
Jameson Graef Rollins
c4e6d3291c test: cleanup search-output test names (no functional change)
Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
2011-06-01 21:59:42 -07:00
Florian Friesdorf
8dcd8b6987 test: add test for sanitized notmuch-search output
This feature was recently added, so it of course needs a test now.

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>

Edited-by: Carl Worth <cworth@cworth.org> Fixed test to use
notmuch_search_sanitize in order to be robust against unpredictable
thread ID numbers, (due to unpredictable order in which the filesystem
presents files).
2011-06-01 21:58:16 -07:00
Jameson Graef Rollins
afdfa5674c test: remove json test for search null result, since it's being more properly tested in search-output
The test in json was inferior to the one in search-output, since it
wasn't properly testing for the presence of a trailing newline.
2011-06-01 16:35:11 -07:00
Jameson Graef Rollins
7a453716c2 test: Move a test from search to search-output, and add a similar json test
The "Search for non-existent message prints nothing" test fits better
with the existing tests in search-output, so move it there. Also add a
similar test for the --format=json case.

These tests also use the new test_expect_equal_file function, (to ensure
that the presence of a trailing newline is correctly tested).
2011-06-01 16:31:52 -07:00
Jameson Graef Rollins
593d96ff1d test: modify search-output test to use the new test_expect_equal_file function
These test now properly test for the presence of a newline at the end
of all output.  Right now some of these test will fail because the
search output is currently broken to *not* produce proper newlines in
some cases.
2011-06-01 13:08:26 -07:00
Jameson Graef Rollins
1d6b49561f tag signed/encrypted during notmuch new
This patch adds the tag "signed" to messages with any multipart/signed
parts, and the tag "encrypted" to messages with any
multipart/encrypted parts.  This only occurs when messages are indexed
during notmuch new, so a database rebuild is required to have old
messages tagged.
2011-05-27 16:22:00 -07:00
Joel Borggrén-Franck
3fa843216c test: change "#!/bin/bash" to "#!/usr/bin/env bash" enhances portability
Change #!/bin/bash at start of tests to "#!/usr/bin/env bash". That way
systems running on bash < 4 can prepend bash >= 4 to path before
running the tests.
2011-05-27 14:03:28 -07:00
Carl Worth
9e0d00f37e test: Add --format=json testing to the "notmuch search --format" tests.
This testing *does* capture the bug of missing '[' and ']' characters
int "notmuch search --output=tags" case. This is another manifestation
of the same bug causing the missing final newline (as mentioned in the
previous commit).
2010-11-23 17:54:47 -08:00
Carl Worth
e2a550b968 test: Add simple tests for "notmuch search --output=<>"
This code simply wasn't being exercised by the test suite before, so
this will be useful.

Meanwhile, there's currently a bug in "notmuch search --output=tags"
in that it doesn't print a final newline. But the current test suite
isn't able to catch this bug since the $() construct of the shell
doesn't preserve the distinction of whether the final newline is
present or not.
2010-11-23 17:41:25 -08:00