Re: [PATCH 08/10] test: set variables using `let' instead of `setq' in Emacs tests

2012-01-24 Thread Xavier Maillard
On Tue, 28 Jun 2011 08:45:09 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 Using `setq' for setting variables in Emacs tests affect other
 tests that may run in the same Emacs environment.  Currently it
 works because each test is run in a separate Emacs instance.  But
 in the future multiple tests will run in a single Emacs instance.
 The patch changes all variables to use `let', so the scope of the
 change is limited to a single test.

+1 (definetely)

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


[PATCH 08/10] test: set variables using `let' instead of `setq' in Emacs tests

2012-01-23 Thread Xavier Maillard
On Tue, 28 Jun 2011 08:45:09 +0400, Dmitry Kurochkin  wrote:
> Using `setq' for setting variables in Emacs tests affect other
> tests that may run in the same Emacs environment.  Currently it
> works because each test is run in a separate Emacs instance.  But
> in the future multiple tests will run in a single Emacs instance.
> The patch changes all variables to use `let', so the scope of the
> change is limited to a single test.

+1 (definetely)

/Xavier


[PATCH 08/10] test: set variables using `let' instead of `setq' in Emacs tests

2011-06-28 Thread Dmitry Kurochkin
Using `setq' for setting variables in Emacs tests affect other
tests that may run in the same Emacs environment.  Currently it
works because each test is run in a separate Emacs instance.  But
in the future multiple tests will run in a single Emacs instance.
The patch changes all variables to use `let', so the scope of the
change is limited to a single test.
---
 test/emacs   |   70 +
 test/test-lib.sh |   27 ++--
 2 files changed, 52 insertions(+), 45 deletions(-)

diff --git a/test/emacs b/test/emacs
index 409e033..3d42645 100755
--- a/test/emacs
+++ b/test/emacs
@@ -1,4 +1,10 @@
 #!/usr/bin/env bash
+
+# Note: do not use `setq' for setting variables in Emacs tests because
+# it affects other tests that may run in the same Emacs instance.  Use
+# `let' instead so the scope of the changed variables is limited to a
+# single test.
+
 test_description="emacs interface"
 . test-lib.sh

@@ -12,20 +18,20 @@ test_emacs '(notmuch-hello)
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello

 test_begin_subtest "Saved search with 0 results"
-test_emacs '(setq notmuch-show-empty-saved-searches t)
-   (setq notmuch-saved-searches
- '\''(("inbox" . "tag:inbox")
-  ("unread" . "tag:unread")
-  ("empty" . "tag:doesnotexist")))
-   (notmuch-hello)
-   (test-output)'
+test_emacs '(let ((notmuch-show-empty-saved-searches t)
+ (notmuch-saved-searches
+  '\''(("inbox" . "tag:inbox")
+   ("unread" . "tag:unread")
+   ("empty" . "tag:doesnotexist"
+ (notmuch-hello)
+ (test-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty

 test_begin_subtest "No saved searches displayed (all with 0 results)"
-test_emacs '(setq notmuch-saved-searches
- '\''(("empty" . "tag:doesnotexist")))
-   (notmuch-hello)
-   (test-output)'
+test_emacs '(let ((notmuch-saved-searches
+  '\''(("empty" . "tag:doesnotexist"
+ (notmuch-hello)
+ (test-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches

 test_begin_subtest "Basic notmuch-search view in emacs"
@@ -147,9 +153,9 @@ output=$(notmuch search 'subject:"testing message sent via 
SMTP"' | notmuch_sear
 test_expect_equal "$output" "thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
Testing message sent via SMTP (inbox)"

 test_begin_subtest "notmuch-fcc-dirs set to nil"
-test_emacs "(setq notmuch-fcc-dirs nil)
-   (notmuch-mua-mail)
-   (test-output)"
+test_emacs "(let ((notmuch-fcc-dirs nil))
+ (notmuch-mua-mail)
+ (test-output))"
 cat 

[PATCH 08/10] test: set variables using `let' instead of `setq' in Emacs tests

2011-06-27 Thread Dmitry Kurochkin
Using `setq' for setting variables in Emacs tests affect other
tests that may run in the same Emacs environment.  Currently it
works because each test is run in a separate Emacs instance.  But
in the future multiple tests will run in a single Emacs instance.
The patch changes all variables to use `let', so the scope of the
change is limited to a single test.
---
 test/emacs   |   70 +
 test/test-lib.sh |   27 ++--
 2 files changed, 52 insertions(+), 45 deletions(-)

diff --git a/test/emacs b/test/emacs
index 409e033..3d42645 100755
--- a/test/emacs
+++ b/test/emacs
@@ -1,4 +1,10 @@
 #!/usr/bin/env bash
+
+# Note: do not use `setq' for setting variables in Emacs tests because
+# it affects other tests that may run in the same Emacs instance.  Use
+# `let' instead so the scope of the changed variables is limited to a
+# single test.
+
 test_description=emacs interface
 . test-lib.sh
 
@@ -12,20 +18,20 @@ test_emacs '(notmuch-hello)
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello
 
 test_begin_subtest Saved search with 0 results
-test_emacs '(setq notmuch-show-empty-saved-searches t)
-   (setq notmuch-saved-searches
- '\''((inbox . tag:inbox)
-  (unread . tag:unread)
-  (empty . tag:doesnotexist)))
-   (notmuch-hello)
-   (test-output)'
+test_emacs '(let ((notmuch-show-empty-saved-searches t)
+ (notmuch-saved-searches
+  '\''((inbox . tag:inbox)
+   (unread . tag:unread)
+   (empty . tag:doesnotexist
+ (notmuch-hello)
+ (test-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-with-empty
 
 test_begin_subtest No saved searches displayed (all with 0 results)
-test_emacs '(setq notmuch-saved-searches
- '\''((empty . tag:doesnotexist)))
-   (notmuch-hello)
-   (test-output)'
+test_emacs '(let ((notmuch-saved-searches
+  '\''((empty . tag:doesnotexist
+ (notmuch-hello)
+ (test-output))'
 test_expect_equal_file OUTPUT $EXPECTED/notmuch-hello-no-saved-searches
 
 test_begin_subtest Basic notmuch-search view in emacs
@@ -147,9 +153,9 @@ output=$(notmuch search 'subject:testing message sent via 
SMTP' | notmuch_sear
 test_expect_equal $output thread:XXX   2000-01-01 [1/1] Notmuch Test Suite; 
Testing message sent via SMTP (inbox)
 
 test_begin_subtest notmuch-fcc-dirs set to nil
-test_emacs (setq notmuch-fcc-dirs nil)
-   (notmuch-mua-mail)
-   (test-output)
+test_emacs (let ((notmuch-fcc-dirs nil))
+ (notmuch-mua-mail)
+ (test-output))
 cat EOF EXPECTED
 From: Notmuch Test Suite test_su...@notmuchmail.org
 To: 
@@ -164,9 +170,9 @@ mkdir -p mail/sent-string/new
 mkdir -p mail/sent-string/tmp
 
 test_begin_subtest notmuch-fcc-dirs set to a string
-test_emacs (setq notmuch-fcc-dirs \sent-string\)
-   (notmuch-mua-mail)
-   (test-output)
+test_emacs (let ((notmuch-fcc-dirs \sent-string\))
+ (notmuch-mua-mail)
+ (test-output))
 cat EOF EXPECTED
 From: Notmuch Test Suite test_su...@notmuchmail.org
 To: 
@@ -185,11 +191,11 @@ mkdir -p mail/failure/new
 mkdir -p mail/failure/tmp
 
 test_begin_subtest notmuch-fcc-dirs set to a list (with match)
-test_emacs (setq notmuch-fcc-dirs
- '((\notmuchmail.org\ . \sent-list-match\)
-   (\.*\ . \failure\)))
-   (notmuch-mua-mail)
-   (test-output)
+test_emacs (let ((notmuch-fcc-dirs
+  '((\notmuchmail.org\ . \sent-list-match\)
+(\.*\ . \failure\
+ (notmuch-mua-mail)
+ (test-output))
 cat EOF EXPECTED
 From: Notmuch Test Suite test_su...@notmuchmail.org
 To: 
@@ -205,11 +211,11 @@ mkdir -p mail/sent-list-catch-all/new
 mkdir -p mail/sent-list-catch-all/tmp
  
 test_begin_subtest notmuch-fcc-dirs set to a list (catch-all)
-test_emacs (setq notmuch-fcc-dirs
- '((\example.com\ . \failure\)
-   (\.*\ . \sent-list-catch-all\)))
-   (notmuch-mua-mail)
-   (test-output)
+test_emacs (let ((notmuch-fcc-dirs
+  '((\example.com\ . \failure\)
+(\.*\ . \sent-list-catch-all\
+ (notmuch-mua-mail)
+ (test-output))
 cat EOF EXPECTED
 From: Notmuch Test Suite test_su...@notmuchmail.org
 To: 
@@ -220,11 +226,11 @@ EOF
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest notmuch-fcc-dirs set to a list (no match)
-test_emacs (setq notmuch-fcc-dirs
- '((\example.com\ . \failure\)
-   (\nomatchhere.net\ . \failure\)))
-   (notmuch-mua-mail)
-   (test-output)
+test_emacs (let ((notmuch-fcc-dirs
+  '((\example.com\ . \failure\)
+(\nomatchhere.net\ . \failure\
+