* [PATCH v3 0/5] add --format=text0 to notmuch search
@ 2012-12-16 21:02 Jani Nikula
2012-12-16 21:02 ` [PATCH v3 1/5] sprinter: clarify separator documentation Jani Nikula
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: Jani Nikula @ 2012-12-16 21:02 UTC (permalink / raw)
To: notmuch
Hi all, v3 of id:cover.1355064714.git.jani@nikula.org
Changes since v2:
* add new patch 1/5 to clarify sprinter documentation
* fix the test patch 4/5 according to id:8738z6wguj.fsf@qmul.ac.uk and
id:87y5gyvvv7.fsf@awakening.csail.mit.edu
Diff to v2 at the end of the cover letter.
BR,
Jani.
Jani Nikula (5):
sprinter: clarify separator documentation
sprinter: add text0 formatter for null character separated text
cli: add --format=text0 to notmuch search
test: notmuch search --format=text0
man: document notmuch search --format=text0
man/man1/notmuch-search.1 | 26 ++++++++++++++++----------
notmuch-search.c | 16 ++++++++++++++--
sprinter-text.c | 22 ++++++++++++++++++++++
sprinter.h | 15 +++++++++++----
test/text | 33 +++++++++++++++++++++++++++++++++
5 files changed, 96 insertions(+), 16 deletions(-)
--
1.7.10.4
diff --git a/sprinter.h b/sprinter.h
index f36b999..f859672 100644
--- a/sprinter.h
+++ b/sprinter.h
@@ -42,10 +42,11 @@ typedef struct sprinter {
*/
void (*map_key) (struct sprinter *, const char *);
- /* Insert a separator (usually extra whitespace) for improved
- * readability without affecting the abstract syntax of the
- * structure being printed.
- * For JSON, this could simply be a line break.
+ /* Insert a separator (usually extra whitespace). For the text
+ * printers, this is a syntactic separator. For the structured
+ * printers, this is for improved readability without affecting
+ * the abstract syntax of the structure being printed. For JSON,
+ * this could simply be a line break.
*/
void (*separator) (struct sprinter *);
diff --git a/test/text b/test/text
index e003a66..b5ccefc 100755
--- a/test/text
+++ b/test/text
@@ -55,30 +55,34 @@ test_expect_equal "$output" \
add_email_corpus
test_begin_subtest "Search message tags: text0"
-cat <<EOF > EXPECTED.$test_count
+cat <<EOF > EXPECTED
attachment inbox signed unread
EOF
-notmuch search --format=text0 --output=tags '*' | xargs -0 | notmuch_search_sanitize > OUTPUT.$test_count
-test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+notmuch search --format=text0 --output=tags '*' | xargs -0 | notmuch_search_sanitize > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
+# Use tr(1) to convert --output=text0 to --output=text for
+# comparison. Also translate newlines to spaces to fail with more
+# noise if they are present as delimiters instead of null
+# characters. This assumes there are no newlines in the data.
test_begin_subtest "Compare text vs. text0 for threads"
-notmuch search --format=text --output=threads '*' | notmuch_search_sanitize > EXPECTED.$test_count
-notmuch search --format=text0 --output=threads '*' | xargs -0 -L1 | notmuch_search_sanitize > OUTPUT.$test_count
-test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+notmuch search --format=text --output=threads '*' | notmuch_search_sanitize > EXPECTED
+notmuch search --format=text0 --output=threads '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "Compare text vs. text0 for messages"
-notmuch search --format=text --output=messages '*' | notmuch_search_sanitize > EXPECTED.$test_count
-notmuch search --format=text0 --output=messages '*' | xargs -0 -L1 | notmuch_search_sanitize > OUTPUT.$test_count
-test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+notmuch search --format=text --output=messages '*' | notmuch_search_sanitize > EXPECTED
+notmuch search --format=text0 --output=messages '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "Compare text vs. text0 for files"
-notmuch search --format=text --output=files '*' | notmuch_search_sanitize > EXPECTED.$test_count
-notmuch search --format=text0 --output=files '*' | xargs -0 -L1 | notmuch_search_sanitize > OUTPUT.$test_count
-test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+notmuch search --format=text --output=files '*' | notmuch_search_sanitize > EXPECTED
+notmuch search --format=text0 --output=files '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest "Compare text vs. text0 for tags"
-notmuch search --format=text --output=tags '*' | notmuch_search_sanitize > EXPECTED.$test_count
-notmuch search --format=text0 --output=tags '*' | xargs -0 -L1 | notmuch_search_sanitize > OUTPUT.$test_count
-test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+notmuch search --format=text --output=tags '*' | notmuch_search_sanitize > EXPECTED
+notmuch search --format=text0 --output=tags '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
test_done
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 1/5] sprinter: clarify separator documentation
2012-12-16 21:02 [PATCH v3 0/5] add --format=text0 to notmuch search Jani Nikula
@ 2012-12-16 21:02 ` Jani Nikula
2012-12-16 21:02 ` [PATCH v3 2/5] sprinter: add text0 formatter for null character separated text Jani Nikula
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2012-12-16 21:02 UTC (permalink / raw)
To: notmuch
For text printers, the separator is a syntactic element.
---
sprinter.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/sprinter.h b/sprinter.h
index 59776a9..f43a844 100644
--- a/sprinter.h
+++ b/sprinter.h
@@ -42,10 +42,11 @@ typedef struct sprinter {
*/
void (*map_key) (struct sprinter *, const char *);
- /* Insert a separator (usually extra whitespace) for improved
- * readability without affecting the abstract syntax of the
- * structure being printed.
- * For JSON, this could simply be a line break.
+ /* Insert a separator (usually extra whitespace). For the text
+ * printers, this is a syntactic separator. For the structured
+ * printers, this is for improved readability without affecting
+ * the abstract syntax of the structure being printed. For JSON,
+ * this could simply be a line break.
*/
void (*separator) (struct sprinter *);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 2/5] sprinter: add text0 formatter for null character separated text
2012-12-16 21:02 [PATCH v3 0/5] add --format=text0 to notmuch search Jani Nikula
2012-12-16 21:02 ` [PATCH v3 1/5] sprinter: clarify separator documentation Jani Nikula
@ 2012-12-16 21:02 ` Jani Nikula
2012-12-16 21:02 ` [PATCH v3 3/5] cli: add --format=text0 to notmuch search Jani Nikula
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2012-12-16 21:02 UTC (permalink / raw)
To: notmuch
Same as the text formatter, but with each field separated by a null
character rather than a newline character.
---
sprinter-text.c | 22 ++++++++++++++++++++++
sprinter.h | 6 ++++++
2 files changed, 28 insertions(+)
diff --git a/sprinter-text.c b/sprinter-text.c
index 10343be..7779488 100644
--- a/sprinter-text.c
+++ b/sprinter-text.c
@@ -68,6 +68,14 @@ text_separator (struct sprinter *sp)
}
static void
+text0_separator (struct sprinter *sp)
+{
+ struct sprinter_text *sptxt = (struct sprinter_text *) sp;
+
+ fputc ('\0', sptxt->stream);
+}
+
+static void
text_set_prefix (struct sprinter *sp, const char *prefix)
{
struct sprinter_text *sptxt = (struct sprinter_text *) sp;
@@ -133,3 +141,17 @@ sprinter_text_create (const void *ctx, FILE *stream)
res->stream = stream;
return &res->vtable;
}
+
+struct sprinter *
+sprinter_text0_create (const void *ctx, FILE *stream)
+{
+ struct sprinter *sp;
+
+ sp = sprinter_text_create (ctx, stream);
+ if (! sp)
+ return NULL;
+
+ sp->separator = text0_separator;
+
+ return sp;
+}
diff --git a/sprinter.h b/sprinter.h
index f43a844..f859672 100644
--- a/sprinter.h
+++ b/sprinter.h
@@ -67,6 +67,12 @@ typedef struct sprinter {
struct sprinter *
sprinter_text_create (const void *ctx, FILE *stream);
+/* Create a new unstructured printer that emits the text format for
+ * "notmuch search", with each field separated by a null character
+ * instead of the newline character. */
+struct sprinter *
+sprinter_text0_create (const void *ctx, FILE *stream);
+
/* Create a new structure printer that emits JSON. */
struct sprinter *
sprinter_json_create (const void *ctx, FILE *stream);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 3/5] cli: add --format=text0 to notmuch search
2012-12-16 21:02 [PATCH v3 0/5] add --format=text0 to notmuch search Jani Nikula
2012-12-16 21:02 ` [PATCH v3 1/5] sprinter: clarify separator documentation Jani Nikula
2012-12-16 21:02 ` [PATCH v3 2/5] sprinter: add text0 formatter for null character separated text Jani Nikula
@ 2012-12-16 21:02 ` Jani Nikula
2012-12-16 21:02 ` [PATCH v3 4/5] test: notmuch search --format=text0 Jani Nikula
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2012-12-16 21:02 UTC (permalink / raw)
To: notmuch
Add new format text0, which is otherwise the same as text, but use the
null character as separator instead of the newline character. This is
similar to find(1) -print0 option, and works together with the
xargs(1) -0 option.
---
notmuch-search.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/notmuch-search.c b/notmuch-search.c
index 6218622..627962b 100644
--- a/notmuch-search.c
+++ b/notmuch-search.c
@@ -305,8 +305,12 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
int exclude = EXCLUDE_TRUE;
unsigned int i;
- enum { NOTMUCH_FORMAT_JSON, NOTMUCH_FORMAT_TEXT, NOTMUCH_FORMAT_SEXP }
- format_sel = NOTMUCH_FORMAT_TEXT;
+ enum {
+ NOTMUCH_FORMAT_JSON,
+ NOTMUCH_FORMAT_TEXT,
+ NOTMUCH_FORMAT_TEXT0,
+ NOTMUCH_FORMAT_SEXP
+ } format_sel = NOTMUCH_FORMAT_TEXT;
notmuch_opt_desc_t options[] = {
{ NOTMUCH_OPT_KEYWORD, &sort, "sort", 's',
@@ -317,6 +321,7 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
(notmuch_keyword_t []){ { "json", NOTMUCH_FORMAT_JSON },
{ "sexp", NOTMUCH_FORMAT_SEXP },
{ "text", NOTMUCH_FORMAT_TEXT },
+ { "text0", NOTMUCH_FORMAT_TEXT0 },
{ 0, 0 } } },
{ NOTMUCH_OPT_KEYWORD, &output, "output", 'o',
(notmuch_keyword_t []){ { "summary", OUTPUT_SUMMARY },
@@ -345,6 +350,13 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
case NOTMUCH_FORMAT_TEXT:
format = sprinter_text_create (ctx, stdout);
break;
+ case NOTMUCH_FORMAT_TEXT0:
+ if (output == OUTPUT_SUMMARY) {
+ fprintf (stderr, "Error: --format=text0 is not compatible with --output=summary.\n");
+ return 1;
+ }
+ format = sprinter_text0_create (ctx, stdout);
+ break;
case NOTMUCH_FORMAT_JSON:
format = sprinter_json_create (ctx, stdout);
break;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 4/5] test: notmuch search --format=text0
2012-12-16 21:02 [PATCH v3 0/5] add --format=text0 to notmuch search Jani Nikula
` (2 preceding siblings ...)
2012-12-16 21:02 ` [PATCH v3 3/5] cli: add --format=text0 to notmuch search Jani Nikula
@ 2012-12-16 21:02 ` Jani Nikula
2012-12-16 21:02 ` [PATCH v3 5/5] man: document " Jani Nikula
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2012-12-16 21:02 UTC (permalink / raw)
To: notmuch
---
test/text | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/test/text b/test/text
index 428c89b..b5ccefc 100755
--- a/test/text
+++ b/test/text
@@ -52,4 +52,37 @@ output=$(notmuch search --format=text "tëxt-search-méssage" | notmuch_search_s
test_expect_equal "$output" \
"thread:XXX 2000-01-01 [1/1] Notmuch Test Suite; text-search-utf8-body-sübjéct (inbox unread)"
+add_email_corpus
+
+test_begin_subtest "Search message tags: text0"
+cat <<EOF > EXPECTED
+attachment inbox signed unread
+EOF
+notmuch search --format=text0 --output=tags '*' | xargs -0 | notmuch_search_sanitize > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
+
+# Use tr(1) to convert --output=text0 to --output=text for
+# comparison. Also translate newlines to spaces to fail with more
+# noise if they are present as delimiters instead of null
+# characters. This assumes there are no newlines in the data.
+test_begin_subtest "Compare text vs. text0 for threads"
+notmuch search --format=text --output=threads '*' | notmuch_search_sanitize > EXPECTED
+notmuch search --format=text0 --output=threads '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "Compare text vs. text0 for messages"
+notmuch search --format=text --output=messages '*' | notmuch_search_sanitize > EXPECTED
+notmuch search --format=text0 --output=messages '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "Compare text vs. text0 for files"
+notmuch search --format=text --output=files '*' | notmuch_search_sanitize > EXPECTED
+notmuch search --format=text0 --output=files '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "Compare text vs. text0 for tags"
+notmuch search --format=text --output=tags '*' | notmuch_search_sanitize > EXPECTED
+notmuch search --format=text0 --output=tags '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
+test_expect_equal_file EXPECTED OUTPUT
+
test_done
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v3 5/5] man: document notmuch search --format=text0
2012-12-16 21:02 [PATCH v3 0/5] add --format=text0 to notmuch search Jani Nikula
` (3 preceding siblings ...)
2012-12-16 21:02 ` [PATCH v3 4/5] test: notmuch search --format=text0 Jani Nikula
@ 2012-12-16 21:02 ` Jani Nikula
2012-12-16 21:07 ` [PATCH v3 0/5] add --format=text0 to notmuch search Austin Clements
2012-12-16 21:13 ` Mark Walters
6 siblings, 0 replies; 8+ messages in thread
From: Jani Nikula @ 2012-12-16 21:02 UTC (permalink / raw)
To: notmuch
---
man/man1/notmuch-search.1 | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/man/man1/notmuch-search.1 b/man/man1/notmuch-search.1
index 0aff348..22bcd0a 100644
--- a/man/man1/notmuch-search.1
+++ b/man/man1/notmuch-search.1
@@ -25,9 +25,11 @@ Supported options for
include
.RS 4
.TP 4
-.BR \-\-format= ( json | sexp | text )
+.BR \-\-format= ( json | sexp | text | text0 )
-Presents the results in either JSON, S-Expressions or plain-text (default).
+Presents the results in either JSON, S-Expressions, newline character
+separated plain-text (default), or null character separated plain-text
+(compatible with \fBxargs\fR(1) -0 option where available).
.RE
.RS 4
@@ -48,32 +50,36 @@ the authors of the thread and the subject.
.B threads
Output the thread IDs of all threads with any message matching the
-search terms, either one per line (\-\-format=text) or as a JSON array
-(\-\-format=json) or an S-Expression list (\-\-format=sexp).
+search terms, either one per line (\-\-format=text), separated by null
+characters (\-\-format=text0), as a JSON array (\-\-format=json), or
+an S-Expression list (\-\-format=sexp).
.RE
.RS 4
.TP 4
.B messages
Output the message IDs of all messages matching the search terms,
-either one per line (\-\-format=text) or as a JSON array
-(\-\-format=json) or as an S-Expression list (\-\-format=sexp).
+either one per line (\-\-format=text), separated by null characters
+(\-\-format=text0), as a JSON array (\-\-format=json), or as an
+S-Expression list (\-\-format=sexp).
.RE
.RS 4
.TP 4
.B files
Output the filenames of all messages matching the search terms, either
-one per line (\-\-format=text) or as a JSON array (\-\-format=json) or
-as an S-Expression list (\-\-format=sexp).
+one per line (\-\-format=text), separated by null characters
+(\-\-format=text0), as a JSON array (\-\-format=json), or as an
+S-Expression list (\-\-format=sexp).
.RE
.RS 4
.TP 4
.B tags
Output all tags that appear on any message matching the search terms,
-either one per line (\-\-format=text) or as a JSON array (\-\-format=json)
-or as an S-Expression list (\-\-format=sexp).
+either one per line (\-\-format=text), separated by null characters
+(\-\-format=text0), as a JSON array (\-\-format=json), or as an
+S-Expression list (\-\-format=sexp).
.RE
.RE
--
1.7.10.4
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/5] add --format=text0 to notmuch search
2012-12-16 21:02 [PATCH v3 0/5] add --format=text0 to notmuch search Jani Nikula
` (4 preceding siblings ...)
2012-12-16 21:02 ` [PATCH v3 5/5] man: document " Jani Nikula
@ 2012-12-16 21:07 ` Austin Clements
2012-12-16 21:13 ` Mark Walters
6 siblings, 0 replies; 8+ messages in thread
From: Austin Clements @ 2012-12-16 21:07 UTC (permalink / raw)
To: Jani Nikula, notmuch
On Sun, 16 Dec 2012, Jani Nikula <jani@nikula.org> wrote:
> Hi all, v3 of id:cover.1355064714.git.jani@nikula.org
>
> Changes since v2:
> * add new patch 1/5 to clarify sprinter documentation
> * fix the test patch 4/5 according to id:8738z6wguj.fsf@qmul.ac.uk and
> id:87y5gyvvv7.fsf@awakening.csail.mit.edu
>
> Diff to v2 at the end of the cover letter.
>
>
> BR,
> Jani.
LGTM.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3 0/5] add --format=text0 to notmuch search
2012-12-16 21:02 [PATCH v3 0/5] add --format=text0 to notmuch search Jani Nikula
` (5 preceding siblings ...)
2012-12-16 21:07 ` [PATCH v3 0/5] add --format=text0 to notmuch search Austin Clements
@ 2012-12-16 21:13 ` Mark Walters
6 siblings, 0 replies; 8+ messages in thread
From: Mark Walters @ 2012-12-16 21:13 UTC (permalink / raw)
To: Jani Nikula, notmuch
On Sun, 16 Dec 2012, Jani Nikula <jani@nikula.org> wrote:
> Hi all, v3 of id:cover.1355064714.git.jani@nikula.org
>
> Changes since v2:
> * add new patch 1/5 to clarify sprinter documentation
> * fix the test patch 4/5 according to id:8738z6wguj.fsf@qmul.ac.uk and
> id:87y5gyvvv7.fsf@awakening.csail.mit.edu
>
> Diff to v2 at the end of the cover letter.
LGTM +1
Best wishes
Mark
>
>
> BR,
> Jani.
>
>
> Jani Nikula (5):
> sprinter: clarify separator documentation
> sprinter: add text0 formatter for null character separated text
> cli: add --format=text0 to notmuch search
> test: notmuch search --format=text0
> man: document notmuch search --format=text0
>
> man/man1/notmuch-search.1 | 26 ++++++++++++++++----------
> notmuch-search.c | 16 ++++++++++++++--
> sprinter-text.c | 22 ++++++++++++++++++++++
> sprinter.h | 15 +++++++++++----
> test/text | 33 +++++++++++++++++++++++++++++++++
> 5 files changed, 96 insertions(+), 16 deletions(-)
>
> --
> 1.7.10.4
>
>
>
> diff --git a/sprinter.h b/sprinter.h
> index f36b999..f859672 100644
> --- a/sprinter.h
> +++ b/sprinter.h
> @@ -42,10 +42,11 @@ typedef struct sprinter {
> */
> void (*map_key) (struct sprinter *, const char *);
>
> - /* Insert a separator (usually extra whitespace) for improved
> - * readability without affecting the abstract syntax of the
> - * structure being printed.
> - * For JSON, this could simply be a line break.
> + /* Insert a separator (usually extra whitespace). For the text
> + * printers, this is a syntactic separator. For the structured
> + * printers, this is for improved readability without affecting
> + * the abstract syntax of the structure being printed. For JSON,
> + * this could simply be a line break.
> */
> void (*separator) (struct sprinter *);
>
> diff --git a/test/text b/test/text
> index e003a66..b5ccefc 100755
> --- a/test/text
> +++ b/test/text
> @@ -55,30 +55,34 @@ test_expect_equal "$output" \
> add_email_corpus
>
> test_begin_subtest "Search message tags: text0"
> -cat <<EOF > EXPECTED.$test_count
> +cat <<EOF > EXPECTED
> attachment inbox signed unread
> EOF
> -notmuch search --format=text0 --output=tags '*' | xargs -0 | notmuch_search_sanitize > OUTPUT.$test_count
> -test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
> +notmuch search --format=text0 --output=tags '*' | xargs -0 | notmuch_search_sanitize > OUTPUT
> +test_expect_equal_file EXPECTED OUTPUT
>
> +# Use tr(1) to convert --output=text0 to --output=text for
> +# comparison. Also translate newlines to spaces to fail with more
> +# noise if they are present as delimiters instead of null
> +# characters. This assumes there are no newlines in the data.
> test_begin_subtest "Compare text vs. text0 for threads"
> -notmuch search --format=text --output=threads '*' | notmuch_search_sanitize > EXPECTED.$test_count
> -notmuch search --format=text0 --output=threads '*' | xargs -0 -L1 | notmuch_search_sanitize > OUTPUT.$test_count
> -test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
> +notmuch search --format=text --output=threads '*' | notmuch_search_sanitize > EXPECTED
> +notmuch search --format=text0 --output=threads '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
> +test_expect_equal_file EXPECTED OUTPUT
>
> test_begin_subtest "Compare text vs. text0 for messages"
> -notmuch search --format=text --output=messages '*' | notmuch_search_sanitize > EXPECTED.$test_count
> -notmuch search --format=text0 --output=messages '*' | xargs -0 -L1 | notmuch_search_sanitize > OUTPUT.$test_count
> -test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
> +notmuch search --format=text --output=messages '*' | notmuch_search_sanitize > EXPECTED
> +notmuch search --format=text0 --output=messages '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
> +test_expect_equal_file EXPECTED OUTPUT
>
> test_begin_subtest "Compare text vs. text0 for files"
> -notmuch search --format=text --output=files '*' | notmuch_search_sanitize > EXPECTED.$test_count
> -notmuch search --format=text0 --output=files '*' | xargs -0 -L1 | notmuch_search_sanitize > OUTPUT.$test_count
> -test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
> +notmuch search --format=text --output=files '*' | notmuch_search_sanitize > EXPECTED
> +notmuch search --format=text0 --output=files '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
> +test_expect_equal_file EXPECTED OUTPUT
>
> test_begin_subtest "Compare text vs. text0 for tags"
> -notmuch search --format=text --output=tags '*' | notmuch_search_sanitize > EXPECTED.$test_count
> -notmuch search --format=text0 --output=tags '*' | xargs -0 -L1 | notmuch_search_sanitize > OUTPUT.$test_count
> -test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
> +notmuch search --format=text --output=tags '*' | notmuch_search_sanitize > EXPECTED
> +notmuch search --format=text0 --output=tags '*' | tr "\n\0" " \n" | notmuch_search_sanitize > OUTPUT
> +test_expect_equal_file EXPECTED OUTPUT
>
> test_done
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-12-16 21:13 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-16 21:02 [PATCH v3 0/5] add --format=text0 to notmuch search Jani Nikula
2012-12-16 21:02 ` [PATCH v3 1/5] sprinter: clarify separator documentation Jani Nikula
2012-12-16 21:02 ` [PATCH v3 2/5] sprinter: add text0 formatter for null character separated text Jani Nikula
2012-12-16 21:02 ` [PATCH v3 3/5] cli: add --format=text0 to notmuch search Jani Nikula
2012-12-16 21:02 ` [PATCH v3 4/5] test: notmuch search --format=text0 Jani Nikula
2012-12-16 21:02 ` [PATCH v3 5/5] man: document " Jani Nikula
2012-12-16 21:07 ` [PATCH v3 0/5] add --format=text0 to notmuch search Austin Clements
2012-12-16 21:13 ` Mark Walters
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).