emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r114957: Make it possible to run tests with a differ


From: Glenn Morris
Subject: [Emacs-diffs] trunk r114957: Make it possible to run tests with a different working directory
Date: Tue, 05 Nov 2013 02:54:44 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114957
revision-id: address@hidden
parent: address@hidden
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Mon 2013-11-04 21:54:38 -0500
message:
  Make it possible to run tests with a different working directory
  
  * test/automated/flymake-tests.el (flymake-tests-data-directory): New.
  (flymake-tests--current-face): Use flymake-tests-data-directory.
  (warning-predicate-function-gcc, warning-predicate-rx-perl)
  (warning-predicate-function-perl): Adapt for above change.
  
  * test/automated/zlib-tests.el (zlib-tests-data-directory): New.
  (zlib--decompress): Use zlib-tests-data-directory.
modified:
  test/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-8588
  test/automated/flymake-tests.el 
flymaketests.el-20130621142346-ara3p0outs2ckhw3-2
  test/automated/zlib-tests.el   zlibtests.el-20130812183522-5qncsha53ebfic8u-1
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2013-11-05 02:22:00 +0000
+++ b/test/ChangeLog    2013-11-05 02:54:38 +0000
@@ -1,5 +1,13 @@
 2013-11-05  Glenn Morris  <address@hidden>
 
+       Make it possible to run tests with a different working directory.
+       * automated/flymake-tests.el (flymake-tests-data-directory): New.
+       (flymake-tests--current-face): Use flymake-tests-data-directory.
+       (warning-predicate-function-gcc, warning-predicate-rx-perl)
+       (warning-predicate-function-perl): Adapt for above change.
+       * automated/zlib-tests.el (zlib-tests-data-directory): New.
+       (zlib--decompress): Use zlib-tests-data-directory.
+
        * automated/eieio-tests.el (eieio-test-37-persistent-classes):
        Remove test that makes no sense.
 

=== modified file 'test/automated/flymake-tests.el'
--- a/test/automated/flymake-tests.el   2013-07-11 15:58:15 +0000
+++ b/test/automated/flymake-tests.el   2013-11-05 02:54:38 +0000
@@ -25,12 +25,17 @@
 (require 'ert)
 (require 'flymake)
 
+(defvar flymake-tests-data-directory
+  (expand-file-name "flymake/warnpred" (getenv "EMACS_TEST_DIRECTORY"))
+  "Directory containing flymake test data.")
+
 
 ;; Warning predicate
 (defun flymake-tests--current-face (file predicate)
-  (let ((buffer (find-file-noselect file)))
+  (let ((buffer (find-file-noselect
+                 (expand-file-name file flymake-tests-data-directory))))
     (unwind-protect
-        (with-current-buffer (find-file-noselect file)
+        (with-current-buffer buffer
           (setq-local flymake-warning-predicate predicate)
           (goto-char (point-min))
           (flymake-mode 1)
@@ -44,9 +49,7 @@
   "Test GCC warning via regexp predicate."
   :expected-result (if (executable-find "gcc") :passed :failed)
   (should (eq 'flymake-warnline
-              (flymake-tests--current-face
-               "flymake/warnpred/test.c"
-               "^[Ww]arning"))))
+              (flymake-tests--current-face "test.c" "^[Ww]arning"))))
 
 (ert-deftest warning-predicate-function-gcc ()
   "Test GCC warning via function predicate."
@@ -54,24 +57,21 @@
                        :passed
                      :failed)
   (should (eq 'flymake-warnline
-              (flymake-tests--current-face
-               "flymake/warnpred/test.c"
+              (flymake-tests--current-face "test.c"
                (lambda (msg) (string-match "^[Ww]arning" msg))))))
 
 (ert-deftest warning-predicate-rx-perl ()
   "Test perl warning via regular expression predicate."
   :expected-result (if (executable-find "perl") :passed :failed)
   (should (eq 'flymake-warnline
-              (flymake-tests--current-face
-               "flymake/warnpred/test.pl"
-               "^Scalar value"))))
+              (flymake-tests--current-face "test.pl" "^Scalar value"))))
 
 (ert-deftest warning-predicate-function-perl ()
   "Test perl warning via function predicate."
   :expected-result (if (executable-find "perl") :passed :failed)
   (should (eq 'flymake-warnline
               (flymake-tests--current-face
-               "flymake/warnpred/test.pl"
+               "test.pl"
                (lambda (msg) (string-match "^Scalar value" msg))))))
 
 (provide 'flymake-tests)

=== modified file 'test/automated/zlib-tests.el'
--- a/test/automated/zlib-tests.el      2013-08-12 18:36:05 +0000
+++ b/test/automated/zlib-tests.el      2013-11-05 02:54:38 +0000
@@ -23,6 +23,10 @@
 
 (require 'ert)
 
+(defvar zlib-tests-data-directory
+  (expand-file-name "data/decompress" (getenv "EMACS_TEST_DIRECTORY"))
+  "Directory containing zlib test data.")
+
 (ert-deftest zlib--decompress ()
   "Test decompressing a gzipped file."
   (when (and (fboundp 'zlib-available-p)
@@ -30,7 +34,8 @@
     (should (string=
             (with-temp-buffer
               (set-buffer-multibyte nil)
-              (insert-file-contents-literally "data/decompress/foo-gzipped")
+              (insert-file-contents-literally
+               (expand-file-name "foo-gzipped" zlib-tests-data-directory))
               (zlib-decompress-region (point-min) (point-max))
               (buffer-string))
             "foo\n"))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]