[PATCH 1/2] test: Search for non-existent message should return nothing

2010-11-04 Thread Carl Worth
On Mon,  1 Nov 2010 17:15:39 +0100, Michal Sojka  wrote:
> My scripts expect that empty search result is actually empty. Since
> commit 6dcb7592, even empty search prints a newline character and this
> breaks my scripts.

Thanks for this fix, Michal.

I get to apologize doubly on this one.

First, I'm sorry that I was greedy and tried to factor out some common
code, not realizing the bug I introduced in the process.

Second, I'm sorry I didn't get your fix into the 0.4 release, (since I
think you did send it before I wrapped that up).

I've at least pushed your fix now. Thanks especially for including a new
test (and fix!) with your bug report. That's hugely appreciated.

-Carl

-- 
carl.d.worth at intel.com
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[PATCH 1/2] test: Search for non-existent message should return nothing

2010-11-01 Thread Michal Sojka
My scripts expect that empty search result is actually empty. Since
commit 6dcb7592, even empty search prints a newline character and this
breaks my scripts.

This patch adds a test for this bug. In the test I cannot use
test_expect_equal function as $() operator suppresses the final
newline and this kind of difference is not detected.

 test/search |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)
---
 test/search |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/test/search b/test/search
index 9132555..5939c6a 100755
--- a/test/search
+++ b/test/search
@@ -96,4 +96,9 @@ add_message '[subject]="utf8-message-body-subject"' 
'[date]="Sat, 01 Jan 2000 12
 output=$(notmuch search "b?d?" | notmuch_search_sanitize)
 test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
utf8-message-body-subject (inbox unread)"

+test_expect_success "Search for non-existent message prints nothing" '
+echo -n > expected &&
+notmuch search "no-message-matches-this" > actual &&
+test_cmp expected actual'
+
 test_done
-- 
1.7.2.3



[PATCH 1/2] test: Search for non-existent message should return nothing

2010-11-01 Thread Michal Sojka
My scripts expect that empty search result is actually empty. Since
commit 6dcb7592, even empty search prints a newline character and this
breaks my scripts.

This patch adds a test for this bug. In the test I cannot use
test_expect_equal function as $() operator suppresses the final
newline and this kind of difference is not detected.

 test/search |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)
---
 test/search |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/test/search b/test/search
index 9132555..5939c6a 100755
--- a/test/search
+++ b/test/search
@@ -96,4 +96,9 @@ add_message '[subject]=utf8-message-body-subject' 
'[date]=Sat, 01 Jan 2000 12
 output=$(notmuch search bödý | notmuch_search_sanitize)
 test_expect_equal $output thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
utf8-message-body-subject (inbox unread)
 
+test_expect_success Search for non-existent message prints nothing '
+echo -n  expected 
+notmuch search no-message-matches-this  actual 
+test_cmp expected actual'
+
 test_done
-- 
1.7.2.3

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch