[Patch v2 11/17] test: add test for notmuch tag --batch option

2012-11-25 Thread Mark Walters

Hi

On Sat, 24 Nov 2012, david at tethera.net wrote:
> From: Jani Nikula 
>
> Basic test of functionality, along with all combinations of options.
> ---
>  test/tagging |   46 ++
>  1 file changed, 46 insertions(+)
>
> diff --git a/test/tagging b/test/tagging
> index 980ff92..e5b8315 100755
> --- a/test/tagging
> +++ b/test/tagging
> @@ -46,6 +46,52 @@ test_expect_equal "$output" "\
>  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (:\"  inbox tag1 
> unread)
>  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 
> unread)"
>  
> +test_begin_subtest "--batch"
> +notmuch tag --batch < +# %20 is a space in tag
> +-:"%20 -tag1 +tag5 +tag6 -- One
> ++tag1 -tag1 -tag4 +tag4 -- Two
> +-tag6 One
> ++tag5 Two
> +EOF
> +output=$(notmuch search \* | notmuch_search_sanitize)
> +test_expect_equal "$output" "\
> +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
> +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 
> unread)"
> +
> +> batch.in  < +# %20 is a space in tag
> +-:"%20 -tag1 +tag5 +tag6 -- One
> ++tag1 -tag1 -tag4 +tag4 -- Two
> +-tag6 One
> ++tag5 Two
> +EOF
> +
> +test_begin_subtest "--input"
> +notmuch tag --input=batch.in
> +output=$(notmuch search \* | notmuch_search_sanitize)
> +test_expect_equal "$output" "\
> +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
> +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 
> unread)"

Wouldn't a different set of tag changes be a better test as presumably
this test can pass if the command just does nothing? 

Mark

> +
> +test_begin_subtest "--batch --input"
> +notmuch tag --batch --input=batch.in
> +output=$(notmuch search \* | notmuch_search_sanitize)
> +test_expect_equal "$output" "\
> +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
> +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 
> unread)"
> +
> +test_begin_subtest "--batch, blank lines and comments"
> +notmuch dump | sort > EXPECTED.$test_count
> +notmuch tag --batch < +# this line is a comment; the next has only white space
> +  
> +
> +# the previous line is empty
> +EOF
> +notmuch dump | sort > OUTPUT.$test_count
> +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
> +
>  test_expect_code 1 "Empty tag names" 'notmuch tag + One'
>  
>  test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
> -- 
> 1.7.10.4
>
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


Re: [Patch v2 11/17] test: add test for notmuch tag --batch option

2012-11-25 Thread Mark Walters

Hi

On Sat, 24 Nov 2012, da...@tethera.net wrote:
 From: Jani Nikula j...@nikula.org

 Basic test of functionality, along with all combinations of options.
 ---
  test/tagging |   46 ++
  1 file changed, 46 insertions(+)

 diff --git a/test/tagging b/test/tagging
 index 980ff92..e5b8315 100755
 --- a/test/tagging
 +++ b/test/tagging
 @@ -46,6 +46,52 @@ test_expect_equal $output \
  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (:\  inbox tag1 
 unread)
  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 
 unread)
  
 +test_begin_subtest --batch
 +notmuch tag --batch EOF
 +# %20 is a space in tag
 +-:%20 -tag1 +tag5 +tag6 -- One
 ++tag1 -tag1 -tag4 +tag4 -- Two
 +-tag6 One
 ++tag5 Two
 +EOF
 +output=$(notmuch search \* | notmuch_search_sanitize)
 +test_expect_equal $output \
 +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
 +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 
 unread)
 +
 + batch.in  EOF
 +# %20 is a space in tag
 +-:%20 -tag1 +tag5 +tag6 -- One
 ++tag1 -tag1 -tag4 +tag4 -- Two
 +-tag6 One
 ++tag5 Two
 +EOF
 +
 +test_begin_subtest --input
 +notmuch tag --input=batch.in
 +output=$(notmuch search \* | notmuch_search_sanitize)
 +test_expect_equal $output \
 +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
 +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 
 unread)

Wouldn't a different set of tag changes be a better test as presumably
this test can pass if the command just does nothing? 

Mark

 +
 +test_begin_subtest --batch --input
 +notmuch tag --batch --input=batch.in
 +output=$(notmuch search \* | notmuch_search_sanitize)
 +test_expect_equal $output \
 +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
 +thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 
 unread)
 +
 +test_begin_subtest --batch, blank lines and comments
 +notmuch dump | sort  EXPECTED.$test_count
 +notmuch tag --batch EOF
 +# this line is a comment; the next has only white space
 +  
 +
 +# the previous line is empty
 +EOF
 +notmuch dump | sort  OUTPUT.$test_count
 +test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 +
  test_expect_code 1 Empty tag names 'notmuch tag + One'
  
  test_expect_code 1 Tag name beginning with - 'notmuch tag +- One'
 -- 
 1.7.10.4

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


[Patch v2 11/17] test: add test for notmuch tag --batch option

2012-11-24 Thread da...@tethera.net
From: Jani Nikula 

Basic test of functionality, along with all combinations of options.
---
 test/tagging |   46 ++
 1 file changed, 46 insertions(+)

diff --git a/test/tagging b/test/tagging
index 980ff92..e5b8315 100755
--- a/test/tagging
+++ b/test/tagging
@@ -46,6 +46,52 @@ test_expect_equal "$output" "\
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (:\"  inbox tag1 unread)
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)"

+test_begin_subtest "--batch"
+notmuch tag --batch < batch.in  < EXPECTED.$test_count
+notmuch tag --batch < OUTPUT.$test_count
+test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+
 test_expect_code 1 "Empty tag names" 'notmuch tag + One'

 test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
-- 
1.7.10.4



[Patch v2 11/17] test: add test for notmuch tag --batch option

2012-11-24 Thread david
From: Jani Nikula j...@nikula.org

Basic test of functionality, along with all combinations of options.
---
 test/tagging |   46 ++
 1 file changed, 46 insertions(+)

diff --git a/test/tagging b/test/tagging
index 980ff92..e5b8315 100755
--- a/test/tagging
+++ b/test/tagging
@@ -46,6 +46,52 @@ test_expect_equal $output \
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (:\  inbox tag1 unread)
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)
 
+test_begin_subtest --batch
+notmuch tag --batch EOF
+# %20 is a space in tag
+-:%20 -tag1 +tag5 +tag6 -- One
++tag1 -tag1 -tag4 +tag4 -- Two
+-tag6 One
++tag5 Two
+EOF
+output=$(notmuch search \* | notmuch_search_sanitize)
+test_expect_equal $output \
+thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
+thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)
+
+ batch.in  EOF
+# %20 is a space in tag
+-:%20 -tag1 +tag5 +tag6 -- One
++tag1 -tag1 -tag4 +tag4 -- Two
+-tag6 One
++tag5 Two
+EOF
+
+test_begin_subtest --input
+notmuch tag --input=batch.in
+output=$(notmuch search \* | notmuch_search_sanitize)
+test_expect_equal $output \
+thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
+thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)
+
+test_begin_subtest --batch --input
+notmuch tag --batch --input=batch.in
+output=$(notmuch search \* | notmuch_search_sanitize)
+test_expect_equal $output \
+thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (inbox tag5 unread)
+thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag4 tag5 unread)
+
+test_begin_subtest --batch, blank lines and comments
+notmuch dump | sort  EXPECTED.$test_count
+notmuch tag --batch EOF
+# this line is a comment; the next has only white space
+
+
+# the previous line is empty
+EOF
+notmuch dump | sort  OUTPUT.$test_count
+test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
+
 test_expect_code 1 Empty tag names 'notmuch tag + One'
 
 test_expect_code 1 Tag name beginning with - 'notmuch tag +- One'
-- 
1.7.10.4

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