From unknown Fri Jun 20 18:03:33 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#9803 <9803@debbugs.gnu.org> To: bug#9803 <9803@debbugs.gnu.org> Subject: Status: Add ERT option to skip test Reply-To: bug#9803 <9803@debbugs.gnu.org> Date: Sat, 21 Jun 2025 01:03:33 +0000 retitle 9803 Add ERT option to skip test reassign 9803 emacs submitter 9803 Glenn Morris severity 9803 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 19 23:44:00 2011 Received: (at submit) by debbugs.gnu.org; 20 Oct 2011 03:44:00 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RGjXw-0004gs-FA for submit@debbugs.gnu.org; Wed, 19 Oct 2011 23:43:58 -0400 Received: from fencepost.gnu.org ([140.186.70.10] ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RGjXs-0004gj-BV for submit@debbugs.gnu.org; Wed, 19 Oct 2011 23:43:54 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1RGjWn-0004nr-MZ; Wed, 19 Oct 2011 23:42:45 -0400 From: Glenn Morris To: submit@debbugs.gnu.org Subject: Add ERT option to skip test X-Spook: Axis of Evil War on Terrorism SP4 IDEA 64 Vauxhall Cross X-Ran: oqO}O,!q4+8ZJ@=Ev>8{&4Tg?_@h User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) Package: emacs Version: 24.0.90 Severity: wishlist I think it would be nice if ert had the ability to skip tests. Eg, a :skip argument that works the same way as :expected-result. This would be useful eg when a test relies on external executable that might not be installed on the system running the tests. You can get the same result by using :expected-result, but :skip might be nicer in such cases. From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 04 14:40:29 2013 Received: (at 9803) by debbugs.gnu.org; 4 Jul 2013 18:40:29 +0000 Received: from localhost ([127.0.0.1]:57857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UuoSC-0003Z4-Kq for submit@debbugs.gnu.org; Thu, 04 Jul 2013 14:40:29 -0400 Received: from mout.gmx.net ([212.227.15.18]:51709) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UuoS9-0003Yc-N0 for 9803@debbugs.gnu.org; Thu, 04 Jul 2013 14:40:26 -0400 Received: from detlef.gmx.de ([93.202.48.1]) by mail.gmx.com (mrgmx002) with ESMTPS (Nemesis) id 0M2Ldk-1U2iKV0ANA-00s2EG; Thu, 04 Jul 2013 20:40:19 +0200 From: Michael Albinus To: Glenn Morris Subject: Re: bug#9803: Add ERT option to skip test References: Date: Thu, 04 Jul 2013 20:40:10 +0200 In-Reply-To: (Glenn Morris's message of "Wed, 19 Oct 2011 23:42:45 -0400") Message-ID: <871u7eb245.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:1NV5FkswSF+4RmSPiTP2nbz1e1SxgA/ZDx2jb4wzyeHPq0lJ4LU lNvJ83Lee+bfYLJl354VnuBPobHqTzQeN0+w9zmBCTVKsc6iHECLRP6uj3YxjykeLfXNW5e GvCWxyYlLq87ambqxDJuyWJjgBwgmUgn/PeP3+n1gugYSpwOaTsApVjtszOqfdneP8H0l7/ 0/iX+gQEHzmlLqYaoq5eg== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9803 Cc: 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Glenn Morris writes: > I think it would be nice if ert had the ability to skip tests. > Eg, a :skip argument that works the same way as :expected-result. > This would be useful eg when a test relies on external executable that > might not be installed on the system running the tests. You can get the > same result by using :expected-result, but :skip might be nicer in such > cases. Skipping tests is already possible. Instead of writing (ert-deftest vc-bzr-test-bug9726 () "Test for http://debbugs.gnu.org/9726 ." :expected-result (if (executable-find vc-bzr-program) :passed :failed) (should (executable-find vc-bzr-program)) ... you could do (when (executable-find vc-bzr-program) (ert-deftest vc-bzr-test-bug9726 () "Test for http://debbugs.gnu.org/9726 ." ... The only drawback I see is that such skipped tests are not listed in the output of an ert run. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 18 09:38:16 2013 Received: (at 9803) by debbugs.gnu.org; 18 Oct 2013 13:38:16 +0000 Received: from localhost ([127.0.0.1]:56657 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXAFq-000505-Br for submit@debbugs.gnu.org; Fri, 18 Oct 2013 09:38:15 -0400 Received: from mout.gmx.net ([212.227.15.19]:50409) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXAFi-0004zb-Cy for 9803@debbugs.gnu.org; Fri, 18 Oct 2013 09:38:08 -0400 Received: from detlef.gmx.de ([93.202.48.241]) by mail.gmx.com (mrgmx101) with ESMTPS (Nemesis) id 0MHso5-1VaBSN0OB3-003eqG for <9803@debbugs.gnu.org>; Fri, 18 Oct 2013 15:37:59 +0200 From: Michael Albinus To: Glenn Morris Subject: Re: bug#9803: [PATCH] Add ERT option to skip test References: Date: Fri, 18 Oct 2013 15:37:52 +0200 In-Reply-To: (Glenn Morris's message of "Wed, 19 Oct 2011 23:42:45 -0400") Message-ID: <87vc0usnrj.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K0:iX4asqtSGptEf7kZD70Vlhv0MXuyKHWI/ix/4AGwV3YQ8DnKyev Ruv/yUtYNnZGos0DTrwKEeJ3PDwWLFPKh5JH+OuZzpLfOx0tgEVdV5S1FrN0fqnnox8HoOA 3PyTT80azNiBL/YbFdZhouLI8S+ergYnt5HonAd1oh4TlmxUKrLY0ZiO4d/aRpeLcPd47ah FBrudk4/0w+U2utNdwTTg== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9803 Cc: 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --=-=-= Content-Type: text/plain Glenn Morris writes: Hi Glenn, > I think it would be nice if ert had the ability to skip tests. > Eg, a :skip argument that works the same way as :expected-result. > This would be useful eg when a test relies on external executable that > might not be installed on the system running the tests. You can get the > same result by using :expected-result, but :skip might be nicer in such > cases. I have written a new macro, which should do the job. It is called `skip-if' and works like `should' and companions. You pass a form as argument, and when it returns non-nil the test is skipped. Test summary is showing skipped tests. Could you, please, check the appended patch, whether it fits your needs? Best regards, Michael. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=ert.el.patch === modified file 'lisp/emacs-lisp/ert.el' *** lisp/emacs-lisp/ert.el 2013-09-17 07:39:54 +0000 --- lisp/emacs-lisp/ert.el 2013-10-18 13:07:57 +0000 *************** *** 174,181 **** BODY is evaluated as a `progn' when the test is run. It should signal a condition on failure or just return if the test passes. ! `should', `should-not' and `should-error' are useful for ! assertions in BODY. Use `ert' to run tests interactively. --- 174,181 ---- BODY is evaluated as a `progn' when the test is run. It should signal a condition on failure or just return if the test passes. ! `should', `should-not', `should-error' and `skip-if' are useful ! for assertions in BODY. Use `ert' to run tests interactively. *************** *** 237,242 **** --- 237,243 ---- (define-error 'ert-test-failed "Test failed") + (define-error 'ert-test-skipped "Test skipped") (defun ert-pass () "Terminate the current test and mark it passed. Does not return." *************** *** 247,252 **** --- 248,258 ---- DATA is displayed to the user and should state the reason of the failure." (signal 'ert-test-failed (list data))) + (defun ert-skip (data) + "Terminate the current test and mark it skipped. Does not return. + DATA is displayed to the user and should state the reason of the failure." + (signal 'ert-test-skipped (list data))) + ;;; The `should' macros. *************** *** 425,430 **** --- 431,446 ---- (list :fail-reason "did not signal an error"))))))))) + (cl-defmacro skip-if (form) + "Evaluate FORM. If it returns non-nil, skip the current test. + + Returns nil." + (declare (debug t)) + (ert--expand-should `(skip-if ,form) form + (lambda (inner-form form-description-form _value-var) + `(unless (not ,inner-form) + (ert-skip ,form-description-form))))) + ;;; Explanation of `should' failures. *************** *** 644,649 **** --- 660,666 ---- (infos (cl-assert nil))) (cl-defstruct (ert-test-quit (:include ert-test-result-with-condition))) (cl-defstruct (ert-test-failed (:include ert-test-result-with-condition))) + (cl-defstruct (ert-test-skipped (:include ert-test-result-with-condition))) (cl-defstruct (ert-test-aborted-with-non-local-exit (:include ert-test-result))) *************** *** 728,733 **** --- 745,751 ---- (let* ((condition (car more-debugger-args)) (type (cl-case (car condition) ((quit) 'quit) + ((ert-test-skipped) 'skipped) (otherwise 'failed))) (backtrace (ert--record-backtrace)) (infos (reverse ert--infos))) *************** *** 737,742 **** --- 755,764 ---- (make-ert-test-quit :condition condition :backtrace backtrace :infos infos)) + (skipped + (make-ert-test-skipped :condition condition + :backtrace backtrace + :infos infos)) (failed (make-ert-test-failed :condition condition :backtrace backtrace *************** *** 862,868 **** nil -- Never matches. t -- Always matches. ! :failed, :passed -- Matches corresponding results. \(and TYPES...\) -- Matches if all TYPES match. \(or TYPES...\) -- Matches if some TYPES match. \(not TYPE\) -- Matches if TYPE does not match. --- 884,890 ---- nil -- Never matches. t -- Always matches. ! :failed, :passed :skipped -- Matches corresponding results. \(and TYPES...\) -- Matches if all TYPES match. \(or TYPES...\) -- Matches if some TYPES match. \(not TYPE\) -- Matches if TYPE does not match. *************** *** 875,880 **** --- 897,903 ---- ((member t) t) ((member :failed) (ert-test-failed-p result)) ((member :passed) (ert-test-passed-p result)) + ((member :skipped) (ert-test-skipped-p result)) (cons (cl-destructuring-bind (operator &rest operands) result-type (cl-ecase operator *************** *** 899,905 **** (defun ert-test-result-expected-p (test result) "Return non-nil if TEST's expected result type matches RESULT." ! (ert-test-result-type-p result (ert-test-expected-result-type test))) (defun ert-select-tests (selector universe) "Return a list of tests that match SELECTOR. --- 922,930 ---- (defun ert-test-result-expected-p (test result) "Return non-nil if TEST's expected result type matches RESULT." ! (or ! (ert-test-result-type-p result :skipped) ! (ert-test-result-type-p result (ert-test-expected-result-type test)))) (defun ert-select-tests (selector universe) "Return a list of tests that match SELECTOR. *************** *** 1085,1090 **** --- 1110,1116 ---- (passed-unexpected 0) (failed-expected 0) (failed-unexpected 0) + (skipped 0) (start-time nil) (end-time nil) (aborted-p nil) *************** *** 1103,1112 **** (+ (ert--stats-passed-unexpected stats) (ert--stats-failed-unexpected stats))) (defun ert-stats-completed (stats) "Number of tests in STATS that have run so far." (+ (ert-stats-completed-expected stats) ! (ert-stats-completed-unexpected stats))) (defun ert-stats-total (stats) "Number of tests in STATS, regardless of whether they have run yet." --- 1129,1143 ---- (+ (ert--stats-passed-unexpected stats) (ert--stats-failed-unexpected stats))) + (defun ert-stats-skipped (stats) + "Number of tests in STATS that have skipped." + (ert--stats-skipped stats)) + (defun ert-stats-completed (stats) "Number of tests in STATS that have run so far." (+ (ert-stats-completed-expected stats) ! (ert-stats-completed-unexpected stats) ! (ert-stats-skipped stats))) (defun ert-stats-total (stats) "Number of tests in STATS, regardless of whether they have run yet." *************** *** 1138,1143 **** --- 1169,1176 ---- (cl-incf (ert--stats-passed-expected stats) d)) (ert-test-failed (cl-incf (ert--stats-failed-expected stats) d)) + (ert-test-skipped + (cl-incf (ert--stats-skipped stats) d)) (null) (ert-test-aborted-with-non-local-exit) (ert-test-quit)) *************** *** 1146,1151 **** --- 1179,1186 ---- (cl-incf (ert--stats-passed-unexpected stats) d)) (ert-test-failed (cl-incf (ert--stats-failed-unexpected stats) d)) + (ert-test-skipped + (cl-incf (ert--stats-skipped stats) d)) (null) (ert-test-aborted-with-non-local-exit) (ert-test-quit))))) *************** *** 1240,1245 **** --- 1275,1281 ---- (let ((s (cl-etypecase result (ert-test-passed ".P") (ert-test-failed "fF") + (ert-test-skipped "sS") (null "--") (ert-test-aborted-with-non-local-exit "aA") (ert-test-quit "qQ")))) *************** *** 1252,1257 **** --- 1288,1294 ---- (let ((s (cl-etypecase result (ert-test-passed '("passed" "PASSED")) (ert-test-failed '("failed" "FAILED")) + (ert-test-skipped '("skipped" "SKIPPED")) (null '("unknown" "UNKNOWN")) (ert-test-aborted-with-non-local-exit '("aborted" "ABORTED")) (ert-test-quit '("quit" "QUIT"))))) *************** *** 1562,1576 **** (ert--insert-human-readable-selector (ert--stats-selector stats)) (insert "\n") (insert ! (format (concat "Passed: %s\n" ! "Failed: %s\n" ! "Total: %s/%s\n\n") (ert--results-format-expected-unexpected (ert--stats-passed-expected stats) (ert--stats-passed-unexpected stats)) (ert--results-format-expected-unexpected (ert--stats-failed-expected stats) (ert--stats-failed-unexpected stats)) run-count (ert-stats-total stats))) (insert --- 1599,1615 ---- (ert--insert-human-readable-selector (ert--stats-selector stats)) (insert "\n") (insert ! (format (concat "Passed: %s\n" ! "Failed: %s\n" ! "Skipped: %s\n" ! "Total: %s/%s\n\n") (ert--results-format-expected-unexpected (ert--stats-passed-expected stats) (ert--stats-passed-unexpected stats)) (ert--results-format-expected-unexpected (ert--stats-failed-expected stats) (ert--stats-failed-unexpected stats)) + (ert-stats-skipped stats) run-count (ert-stats-total stats))) (insert --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 18 21:02:50 2013 Received: (at 9803) by debbugs.gnu.org; 19 Oct 2013 01:02:50 +0000 Received: from localhost ([127.0.0.1]:57417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXKwL-0007hN-Rk for submit@debbugs.gnu.org; Fri, 18 Oct 2013 21:02:50 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:37716 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXKwJ-0007hD-36 for 9803@debbugs.gnu.org; Fri, 18 Oct 2013 21:02:47 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1VXKwH-00065V-U3; Fri, 18 Oct 2013 21:02:45 -0400 From: Glenn Morris To: Michael Albinus Subject: Re: bug#9803: [PATCH] Add ERT option to skip test References: <87vc0usnrj.fsf@gmx.de> X-Spook: Ansar al-Islam terrorism pipeline Cocaine fissionable X-Ran: ,Y+Vf7'vj!W[MBo(UAzj]wNIQA7mBqT/YjG7Wi}A]Y_XW4C7rQV?w6 (Michael Albinus's message of "Fri, 18 Oct 2013 15:37:52 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.5 (-----) X-Debbugs-Envelope-To: 9803 Cc: 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.5 (-----) Michael Albinus wrote: >> I think it would be nice if ert had the ability to skip tests. >> Eg, a :skip argument that works the same way as :expected-result. [...] > I have written a new macro, which should do the job. It is called > `skip-if' and works like `should' and companions. You pass a form as > argument, and when it returns non-nil the test is skipped. Thank you, looks nice. Your method is not quite how I imagined it working, but maybe your way is better, I haven't thought about it much... With your approach, it seems like I have to specify the skip condition twice? Eg I have to write: (ert-deftest foo-test () "Test for foo." :expected-result (if (executable-find "foo") :passed :skipped) (skip-if (not (executable-find "foo"))) t ; in a real use case, some test using "foo" here ) rather than: (ert-deftest foo-test () "Test for foo." :skip (not (executable-find "foo")) t) I think `skip-if' should have an ert- prefix. (I know `should' doesn't, but I think it, err, should as well. But too late for that one now.) Also, ert-run-tests-batch-and-exit seems to need updating: Running 1 tests (2013-10-18 17:49:11-0700) skipped 1/1 foo-test Ran 1 tests, 0 results as expected (2013-10-18 17:49:11-0700) I don't think "0 results as expected" is appropriate. Eg automake uses a summary like this: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11745 From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 18 22:12:34 2013 Received: (at 9803) by debbugs.gnu.org; 19 Oct 2013 02:12:34 +0000 Received: from localhost ([127.0.0.1]:57470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXM1p-00015a-Dk for submit@debbugs.gnu.org; Fri, 18 Oct 2013 22:12:33 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:14751) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXM1n-00015N-3x for 9803@debbugs.gnu.org; Fri, 18 Oct 2013 22:12:31 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFsr+S0/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFFsr+S0/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="35854997" Received: from 108-175-228-180.dsl.teksavvy.com (HELO pastel.home) ([108.175.228.180]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 18 Oct 2013 22:12:25 -0400 Received: by pastel.home (Postfix, from userid 20848) id D4818610B6; Fri, 18 Oct 2013 22:12:24 -0400 (EDT) From: Stefan Monnier To: Glenn Morris Subject: Re: bug#9803: [PATCH] Add ERT option to skip test Message-ID: References: <87vc0usnrj.fsf@gmx.de> Date: Fri, 18 Oct 2013 22:12:24 -0400 In-Reply-To: (Glenn Morris's message of "Fri, 18 Oct 2013 21:02:45 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 9803 Cc: Michael Albinus , 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > I think `skip-if' should have an ert- prefix. (I know `should' doesn't, > but I think it, err, should as well. But too late for that one now.) Rather than add a prefix to `should' we could/should make it so it's only defined within an ert-deftest (like the `go' macro in `cl-tagbody'). Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 19 02:44:27 2013 Received: (at 9803) by debbugs.gnu.org; 19 Oct 2013 06:44:27 +0000 Received: from localhost ([127.0.0.1]:57574 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXQGx-0008AN-30 for submit@debbugs.gnu.org; Sat, 19 Oct 2013 02:44:27 -0400 Received: from mout.gmx.net ([212.227.17.20]:59853) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXQGt-0008A8-1E for 9803@debbugs.gnu.org; Sat, 19 Oct 2013 02:44:24 -0400 Received: from detlef.gmx.de ([93.202.48.191]) by mail.gmx.com (mrgmx001) with ESMTPS (Nemesis) id 0M4nt7-1VxDUj0X9h-00ywrW for <9803@debbugs.gnu.org>; Sat, 19 Oct 2013 08:44:16 +0200 From: Michael Albinus To: Glenn Morris Subject: Re: bug#9803: [PATCH] Add ERT option to skip test References: <87vc0usnrj.fsf@gmx.de> Date: Sat, 19 Oct 2013 08:44:14 +0200 In-Reply-To: (Glenn Morris's message of "Fri, 18 Oct 2013 21:02:45 -0400") Message-ID: <87li1p220x.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:FNIZx8P+vgPWcSm5ouJbTYmX0/4FhZwScqD/J77/Qnsp1JN9/lP IjjpDUsZHu+LHEndfwfihxq1gKeW5wtFx1PcTfUwQcGyECaEaATafKuNX5Dsh8m9w4LQug0 LRgYRfA5s6P9qzJKMrsM0UD9nKawQCacdiuyWFYxpjWldEh5KoRltRXJPqBaTMKDOOwNQp2 X50AErAhYnEtKc+LE2cog== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9803 Cc: 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Glenn Morris writes: > Thank you, looks nice. > Your method is not quite how I imagined it working, but maybe your way is > better, I haven't thought about it much... With your approach, it seems > like I have to specify the skip condition twice? Eg I have to write: > > (ert-deftest foo-test () > "Test for foo." > :expected-result (if (executable-find "foo") :passed :skipped) > (skip-if (not (executable-find "foo"))) > t ; in a real use case, some test using "foo" here > ) > > rather than: > > (ert-deftest foo-test () > "Test for foo." > :skip (not (executable-find "foo")) > t) No. The idea is that skip-if works whatever you have defined in :expected-result. It simply ignores :expected-result, when it finds a non-nil form. > Also, ert-run-tests-batch-and-exit seems to need updating: > > Running 1 tests (2013-10-18 17:49:11-0700) > skipped 1/1 foo-test > > Ran 1 tests, 0 results as expected (2013-10-18 17:49:11-0700) > > I don't think "0 results as expected" is appropriate. Will check. I've tested the interactive call so far. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 19 02:45:08 2013 Received: (at 9803) by debbugs.gnu.org; 19 Oct 2013 06:45:08 +0000 Received: from localhost ([127.0.0.1]:57578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXQHb-0008Bx-3E for submit@debbugs.gnu.org; Sat, 19 Oct 2013 02:45:08 -0400 Received: from mout.gmx.net ([212.227.15.15]:57809) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXQHY-0008B4-6A for 9803@debbugs.gnu.org; Sat, 19 Oct 2013 02:45:04 -0400 Received: from detlef.gmx.de ([93.202.48.191]) by mail.gmx.com (mrgmx001) with ESMTPS (Nemesis) id 0MOw4N-1VcfTq1fd9-006RTF for <9803@debbugs.gnu.org>; Sat, 19 Oct 2013 08:44:58 +0200 From: Michael Albinus To: Stefan Monnier Subject: Re: bug#9803: [PATCH] Add ERT option to skip test References: <87vc0usnrj.fsf@gmx.de> Date: Sat, 19 Oct 2013 08:44:56 +0200 In-Reply-To: (Stefan Monnier's message of "Fri, 18 Oct 2013 22:12:24 -0400") Message-ID: <87hacd21zr.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:E0N7YL6IYl/zocHkX/OX3yABPEMLPF+u2kxGeKZTrRs/nxYU0UU YCzyQR3BIUDw8a6LLcoG4R5NW8MZJT4n8AUSiK103df6lYZY24ufA8jS1MIRYAzRbGwbi3d EGsHFl9ergKfkShzMRAfiZQm9q+BZSpYTrIE0CsAONz9SId5iysec6OFMUAaLji69XT8sE1 cLmBg97AZgcAZOyfBC81Q== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9803 Cc: Glenn Morris , 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Stefan Monnier writes: >> I think `skip-if' should have an ert- prefix. (I know `should' doesn't, >> but I think it, err, should as well. But too late for that one now.) > > Rather than add a prefix to `should' we could/should make it so it's > only defined within an ert-deftest (like the `go' macro in `cl-tagbody'). Yep. Will do. > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 19 22:02:33 2013 Received: (at 9803) by debbugs.gnu.org; 20 Oct 2013 02:02:33 +0000 Received: from localhost ([127.0.0.1]:58441 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXiLg-0008Ig-R5 for submit@debbugs.gnu.org; Sat, 19 Oct 2013 22:02:33 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:55663 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXiLe-0008IY-Tr for 9803@debbugs.gnu.org; Sat, 19 Oct 2013 22:02:31 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1VXiLe-0004TD-9Q; Sat, 19 Oct 2013 22:02:30 -0400 From: Glenn Morris To: Michael Albinus Subject: Re: bug#9803: [PATCH] Add ERT option to skip test References: <87vc0usnrj.fsf@gmx.de> <87li1p220x.fsf@gmx.de> X-Spook: White Water CNCIS John Kerry basement beanpole Operation X-Ran: ;*+]0m|NozAio=?m@[v*qJ>wqY[8zuGs[3hY5K|a8#_?oux~;'M_c5NQ3YnN.u/Z(MB78h X-Hue: blue X-Debbugs-No-Ack: yes X-Attribution: GM Date: Sat, 19 Oct 2013 22:02:30 -0400 In-Reply-To: <87li1p220x.fsf@gmx.de> (Michael Albinus's message of "Sat, 19 Oct 2013 08:44:14 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: 9803 Cc: 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.4 (-----) Michael Albinus wrote: > No. The idea is that skip-if works whatever you have defined in > :expected-result. It simply ignores :expected-result, when it finds a > non-nil form. For some reason I thought I had to specify :expected-result :skipped as well, but I can no longer reproduce whatever led me to think that. From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 20 10:09:28 2013 Received: (at 9803) by debbugs.gnu.org; 20 Oct 2013 14:09:28 +0000 Received: from localhost ([127.0.0.1]:59197 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXth9-0002Ye-N5 for submit@debbugs.gnu.org; Sun, 20 Oct 2013 10:09:28 -0400 Received: from mout.gmx.net ([212.227.17.20]:64816) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VXtgy-0002YF-JB for 9803@debbugs.gnu.org; Sun, 20 Oct 2013 10:09:25 -0400 Received: from arthur.gmx.de ([87.146.53.40]) by mail.gmx.com (mrgmx101) with ESMTPS (Nemesis) id 0LrrRi-1VjDHm1unu-013dH4 for <9803@debbugs.gnu.org>; Sun, 20 Oct 2013 16:09:10 +0200 From: Michael Albinus To: Glenn Morris Subject: Re: bug#9803: [PATCH] Add ERT option to skip test References: <87vc0usnrj.fsf@gmx.de> Date: Sun, 20 Oct 2013 16:09:07 +0200 In-Reply-To: (Glenn Morris's message of "Fri, 18 Oct 2013 21:02:45 -0400") Message-ID: <87txgcyqyk.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K0:dpQvEYuJMg69Zj322yT1tv6my4WzVPpNvZiDwasAcpwyRlB9Rv5 p5NLclDqTTHmyv4f7YRMFPRtEoowEh4WQ8HDb2kfO3WYYTfSE3Kgk+p74bnd+RgwIOYGn5o SeveGsbIeXj8uxqfuEEfxzkHPIvDBqL4OOaKlJrRCJeOb/nwQ5v9HLLg7CY4vzrePdtGlHO +FFo/8p6vGHzswz5FEV/A== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9803 Cc: 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --=-=-= Content-Type: text/plain Glenn Morris writes: Hi Glenn, > I think `skip-if' should have an ert- prefix. (I know `should' doesn't, > but I think it, err, should as well. But too late for that one now.) I've tried to change it as proposed by Stefan, but I'm too stupid to manage all this sophisticated cl-* stuff :-( > Also, ert-run-tests-batch-and-exit seems to need updating: > > Running 1 tests (2013-10-18 17:49:11-0700) > skipped 1/1 foo-test > > Ran 1 tests, 0 results as expected (2013-10-18 17:49:11-0700) > > I don't think "0 results as expected" is appropriate. > > Eg automake uses a summary like this: > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11745 Such a verbose summary is returned when you run the tests interactively. I've reworked the patch in order to give also valid statistics in batch mode. Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=123.patch === modified file 'lisp/emacs-lisp/ert.el' *** lisp/emacs-lisp/ert.el 2013-09-17 07:39:54 +0000 --- lisp/emacs-lisp/ert.el 2013-10-20 13:55:50 +0000 *************** *** 174,181 **** BODY is evaluated as a `progn' when the test is run. It should signal a condition on failure or just return if the test passes. ! `should', `should-not' and `should-error' are useful for ! assertions in BODY. Use `ert' to run tests interactively. --- 174,181 ---- BODY is evaluated as a `progn' when the test is run. It should signal a condition on failure or just return if the test passes. ! `should', `should-not', `should-error' and `skip-if' are useful ! for assertions in BODY. Use `ert' to run tests interactively. *************** *** 237,242 **** --- 237,243 ---- (define-error 'ert-test-failed "Test failed") + (define-error 'ert-test-skipped "Test skipped") (defun ert-pass () "Terminate the current test and mark it passed. Does not return." *************** *** 247,252 **** --- 248,258 ---- DATA is displayed to the user and should state the reason of the failure." (signal 'ert-test-failed (list data))) + (defun ert-skip (data) + "Terminate the current test and mark it skipped. Does not return. + DATA is displayed to the user and should state the reason of the failure." + (signal 'ert-test-skipped (list data))) + ;;; The `should' macros. *************** *** 425,430 **** --- 431,446 ---- (list :fail-reason "did not signal an error"))))))))) + (cl-defmacro skip-if (form) + "Evaluate FORM. If it returns non-nil, skip the current test. + + Returns nil." + (declare (debug t)) + (ert--expand-should `(skip-if ,form) form + (lambda (inner-form form-description-form _value-var) + `(unless (not ,inner-form) + (ert-skip ,form-description-form))))) + ;;; Explanation of `should' failures. *************** *** 644,649 **** --- 660,666 ---- (infos (cl-assert nil))) (cl-defstruct (ert-test-quit (:include ert-test-result-with-condition))) (cl-defstruct (ert-test-failed (:include ert-test-result-with-condition))) + (cl-defstruct (ert-test-skipped (:include ert-test-result-with-condition))) (cl-defstruct (ert-test-aborted-with-non-local-exit (:include ert-test-result))) *************** *** 728,733 **** --- 745,751 ---- (let* ((condition (car more-debugger-args)) (type (cl-case (car condition) ((quit) 'quit) + ((ert-test-skipped) 'skipped) (otherwise 'failed))) (backtrace (ert--record-backtrace)) (infos (reverse ert--infos))) *************** *** 737,742 **** --- 755,764 ---- (make-ert-test-quit :condition condition :backtrace backtrace :infos infos)) + (skipped + (make-ert-test-skipped :condition condition + :backtrace backtrace + :infos infos)) (failed (make-ert-test-failed :condition condition :backtrace backtrace *************** *** 862,868 **** nil -- Never matches. t -- Always matches. ! :failed, :passed -- Matches corresponding results. \(and TYPES...\) -- Matches if all TYPES match. \(or TYPES...\) -- Matches if some TYPES match. \(not TYPE\) -- Matches if TYPE does not match. --- 884,890 ---- nil -- Never matches. t -- Always matches. ! :failed, :passed :skipped -- Matches corresponding results. \(and TYPES...\) -- Matches if all TYPES match. \(or TYPES...\) -- Matches if some TYPES match. \(not TYPE\) -- Matches if TYPE does not match. *************** *** 875,880 **** --- 897,903 ---- ((member t) t) ((member :failed) (ert-test-failed-p result)) ((member :passed) (ert-test-passed-p result)) + ((member :skipped) (ert-test-skipped-p result)) (cons (cl-destructuring-bind (operator &rest operands) result-type (cl-ecase operator *************** *** 899,905 **** (defun ert-test-result-expected-p (test result) "Return non-nil if TEST's expected result type matches RESULT." ! (ert-test-result-type-p result (ert-test-expected-result-type test))) (defun ert-select-tests (selector universe) "Return a list of tests that match SELECTOR. --- 922,930 ---- (defun ert-test-result-expected-p (test result) "Return non-nil if TEST's expected result type matches RESULT." ! (or ! (ert-test-result-type-p result :skipped) ! (ert-test-result-type-p result (ert-test-expected-result-type test)))) (defun ert-select-tests (selector universe) "Return a list of tests that match SELECTOR. *************** *** 1085,1090 **** --- 1110,1116 ---- (passed-unexpected 0) (failed-expected 0) (failed-unexpected 0) + (skipped 0) (start-time nil) (end-time nil) (aborted-p nil) *************** *** 1103,1112 **** (+ (ert--stats-passed-unexpected stats) (ert--stats-failed-unexpected stats))) (defun ert-stats-completed (stats) "Number of tests in STATS that have run so far." (+ (ert-stats-completed-expected stats) ! (ert-stats-completed-unexpected stats))) (defun ert-stats-total (stats) "Number of tests in STATS, regardless of whether they have run yet." --- 1129,1143 ---- (+ (ert--stats-passed-unexpected stats) (ert--stats-failed-unexpected stats))) + (defun ert-stats-skipped (stats) + "Number of tests in STATS that have skipped." + (ert--stats-skipped stats)) + (defun ert-stats-completed (stats) "Number of tests in STATS that have run so far." (+ (ert-stats-completed-expected stats) ! (ert-stats-completed-unexpected stats) ! (ert-stats-skipped stats))) (defun ert-stats-total (stats) "Number of tests in STATS, regardless of whether they have run yet." *************** *** 1138,1143 **** --- 1169,1176 ---- (cl-incf (ert--stats-passed-expected stats) d)) (ert-test-failed (cl-incf (ert--stats-failed-expected stats) d)) + (ert-test-skipped + (cl-incf (ert--stats-skipped stats) d)) (null) (ert-test-aborted-with-non-local-exit) (ert-test-quit)) *************** *** 1146,1151 **** --- 1179,1186 ---- (cl-incf (ert--stats-passed-unexpected stats) d)) (ert-test-failed (cl-incf (ert--stats-failed-unexpected stats) d)) + (ert-test-skipped + (cl-incf (ert--stats-skipped stats) d)) (null) (ert-test-aborted-with-non-local-exit) (ert-test-quit))))) *************** *** 1240,1245 **** --- 1275,1281 ---- (let ((s (cl-etypecase result (ert-test-passed ".P") (ert-test-failed "fF") + (ert-test-skipped "sS") (null "--") (ert-test-aborted-with-non-local-exit "aA") (ert-test-quit "qQ")))) *************** *** 1252,1257 **** --- 1288,1294 ---- (let ((s (cl-etypecase result (ert-test-passed '("passed" "PASSED")) (ert-test-failed '("failed" "FAILED")) + (ert-test-skipped '("skipped" "SKIPPED")) (null '("unknown" "UNKNOWN")) (ert-test-aborted-with-non-local-exit '("aborted" "ABORTED")) (ert-test-quit '("quit" "QUIT"))))) *************** *** 1317,1330 **** (ert--format-time-iso8601 (ert--stats-start-time stats))))) (run-ended (cl-destructuring-bind (stats abortedp) event-args ! (let ((unexpected (ert-stats-completed-unexpected stats)) (expected-failures (ert--stats-failed-expected stats))) ! (message "\n%sRan %s tests, %s results as expected%s (%s)%s\n" (if (not abortedp) "" "Aborted: ") (ert-stats-total stats) ! (ert-stats-completed-expected stats) (if (zerop unexpected) "" (format ", %s unexpected" unexpected)) --- 1354,1371 ---- (ert--format-time-iso8601 (ert--stats-start-time stats))))) (run-ended (cl-destructuring-bind (stats abortedp) event-args ! (let ((skipped (ert-stats-skipped stats)) ! (unexpected (ert-stats-completed-unexpected stats)) (expected-failures (ert--stats-failed-expected stats))) ! (message "\n%sRan %s tests, %s results as expected%s%s (%s)%s\n" (if (not abortedp) "" "Aborted: ") (ert-stats-total stats) ! (ert-stats-completed-expected stats) ! (if (zerop skipped) ! "" ! (format ", %s skipped" skipped)) (if (zerop unexpected) "" (format ", %s unexpected" unexpected)) *************** *** 1332,1337 **** --- 1373,1387 ---- (if (zerop expected-failures) "" (format "\n%s expected failures" expected-failures))) + (unless (zerop skipped) + (message "%s skipped results:" skipped) + (cl-loop for test across (ert--stats-tests stats) + for result = (ert-test-most-recent-result test) do + (when (ert-test-result-type-p result :skipped) + (message "%9s %S" + (ert-string-for-test-result result nil) + (ert-test-name test)))) + (message "%s" "")) (unless (zerop unexpected) (message "%s unexpected results:" unexpected) (cl-loop for test across (ert--stats-tests stats) *************** *** 1562,1576 **** (ert--insert-human-readable-selector (ert--stats-selector stats)) (insert "\n") (insert ! (format (concat "Passed: %s\n" ! "Failed: %s\n" ! "Total: %s/%s\n\n") (ert--results-format-expected-unexpected (ert--stats-passed-expected stats) (ert--stats-passed-unexpected stats)) (ert--results-format-expected-unexpected (ert--stats-failed-expected stats) (ert--stats-failed-unexpected stats)) run-count (ert-stats-total stats))) (insert --- 1612,1628 ---- (ert--insert-human-readable-selector (ert--stats-selector stats)) (insert "\n") (insert ! (format (concat "Passed: %s\n" ! "Failed: %s\n" ! "Skipped: %s\n" ! "Total: %s/%s\n\n") (ert--results-format-expected-unexpected (ert--stats-passed-expected stats) (ert--stats-passed-unexpected stats)) (ert--results-format-expected-unexpected (ert--stats-failed-expected stats) (ert--stats-failed-unexpected stats)) + (ert-stats-skipped stats) run-count (ert-stats-total stats))) (insert --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 21 11:08:46 2013 Received: (at 9803) by debbugs.gnu.org; 21 Oct 2013 15:08:46 +0000 Received: from localhost ([127.0.0.1]:60843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYH65-0007qQ-GN for submit@debbugs.gnu.org; Mon, 21 Oct 2013 11:08:46 -0400 Received: from mout.gmx.net ([212.227.17.20]:54922) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYH62-0007q4-1u for 9803@debbugs.gnu.org; Mon, 21 Oct 2013 11:08:44 -0400 Received: from detlef.gmx.de ([93.202.58.207]) by mail.gmx.com (mrgmx101) with ESMTPS (Nemesis) id 0M2XkX-1VoZSW2ENB-00sJRl for <9803@debbugs.gnu.org>; Mon, 21 Oct 2013 17:08:36 +0200 From: Michael Albinus To: Glenn Morris Subject: Re: bug#9803: [PATCH] Add ERT option to skip test References: <87vc0usnrj.fsf@gmx.de> <87txgcyqyk.fsf@gmx.de> Date: Mon, 21 Oct 2013 17:08:31 +0200 In-Reply-To: <87txgcyqyk.fsf@gmx.de> (Michael Albinus's message of "Sun, 20 Oct 2013 16:09:07 +0200") Message-ID: <87ppqywtjk.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Provags-ID: V03:K0:oVIUQwUiyt/0Hd8a3r2s1SKC6znEAy977hnkksCNkhJlLnJaApi uq2VKAMHGBXq83WUMhs2KNFGL7LrpAvaZ7Ew51oHmG0/gJ0hE2hQuasVnf5PGqeWQUNgUN4 1JxMmYRNzpfkR13VKeSlvBNgZUWclW77T1199jjGlrFR21yA2asbiA0K3Zi1GZGlCyvhPQb KGNQn3MV2P2lDagf81dVQ== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9803 Cc: 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --=-=-= Content-Type: text/plain Michael Albinus writes: Hi Glenn, >> I think `skip-if' should have an ert- prefix. (I know `should' doesn't, >> but I think it, err, should as well. But too late for that one now.) > > I've tried to change it as proposed by Stefan, but I'm too stupid to > manage all this sophisticated cl-* stuff :-( Well, I've made a change to call (fset 'skip-if 'ert--skip-if) in ert--run-test-internal. After running the test, it is reverted by (unintern 'skip-if nil). Therefore, `skip-if' is visible only inside tests defined with `ert-deftest'. If this is acceptable, I could apply this change also for `should', `should-not' and `should-error'. Do you (and Stefan) agree? Best regards, Michael. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=123.patch === modified file 'lisp/emacs-lisp/ert.el' *** lisp/emacs-lisp/ert.el 2013-09-17 07:39:54 +0000 --- lisp/emacs-lisp/ert.el 2013-10-21 15:04:51 +0000 *************** *** 34,47 **** ;; `ert-run-tests-batch-and-exit' for non-interactive use. ;; ;; The body of `ert-deftest' forms resembles a function body, but the ! ;; additional operators `should', `should-not' and `should-error' are ! ;; available. `should' is similar to cl's `assert', but signals a ! ;; different error when its condition is violated that is caught and ! ;; processed by ERT. In addition, it analyzes its argument form and ! ;; records information that helps debugging (`assert' tries to do ! ;; something similar when its second argument SHOW-ARGS is true, but ! ;; `should' is more sophisticated). For information on `should-not' ! ;; and `should-error', see their docstrings. ;; ;; See ERT's info manual as well as the docstrings for more details. ;; To compile the manual, run `makeinfo ert.texinfo' in the ERT --- 34,50 ---- ;; `ert-run-tests-batch-and-exit' for non-interactive use. ;; ;; The body of `ert-deftest' forms resembles a function body, but the ! ;; additional operators `should', `should-not', `should-error' and ! ;; `skip-if' are available. `should' is similar to cl's `assert', but ! ;; signals a different error when its condition is violated that is ! ;; caught and processed by ERT. In addition, it analyzes its argument ! ;; form and records information that helps debugging (`assert' tries ! ;; to do something similar when its second argument SHOW-ARGS is true, ! ;; but `should' is more sophisticated). For information on ! ;; `should-not' and `should-error', see their docstrings. `skip-if' ! ;; skips the test without checking the result, this is useful for ! ;; checking the test environmont (like availability of external ! ;; binaries, etc). ;; ;; See ERT's info manual as well as the docstrings for more details. ;; To compile the manual, run `makeinfo ert.texinfo' in the ERT *************** *** 174,181 **** BODY is evaluated as a `progn' when the test is run. It should signal a condition on failure or just return if the test passes. ! `should', `should-not' and `should-error' are useful for ! assertions in BODY. Use `ert' to run tests interactively. --- 177,184 ---- BODY is evaluated as a `progn' when the test is run. It should signal a condition on failure or just return if the test passes. ! `should', `should-not', `should-error' and `skip-if' are useful ! for assertions in BODY. Use `ert' to run tests interactively. *************** *** 237,242 **** --- 240,246 ---- (define-error 'ert-test-failed "Test failed") + (define-error 'ert-test-skipped "Test skipped") (defun ert-pass () "Terminate the current test and mark it passed. Does not return." *************** *** 247,252 **** --- 251,261 ---- DATA is displayed to the user and should state the reason of the failure." (signal 'ert-test-failed (list data))) + (defun ert-skip (data) + "Terminate the current test and mark it skipped. Does not return. + DATA is displayed to the user and should state the reason for skipping." + (signal 'ert-test-skipped (list data))) + ;;; The `should' macros. *************** *** 425,430 **** --- 434,449 ---- (list :fail-reason "did not signal an error"))))))))) + (cl-defmacro ert--skip-if (form) + "Evaluate FORM. If it returns non-nil, skip the current test. + + Returns nil." + (declare (debug t)) + (ert--expand-should `(skip-if ,form) form + (lambda (inner-form form-description-form _value-var) + `(unless (not ,inner-form) + (ert-skip ,form-description-form))))) + ;;; Explanation of `should' failures. *************** *** 644,649 **** --- 663,669 ---- (infos (cl-assert nil))) (cl-defstruct (ert-test-quit (:include ert-test-result-with-condition))) (cl-defstruct (ert-test-failed (:include ert-test-result-with-condition))) + (cl-defstruct (ert-test-skipped (:include ert-test-result-with-condition))) (cl-defstruct (ert-test-aborted-with-non-local-exit (:include ert-test-result))) *************** *** 728,733 **** --- 748,754 ---- (let* ((condition (car more-debugger-args)) (type (cl-case (car condition) ((quit) 'quit) + ((ert-test-skipped) 'skipped) (otherwise 'failed))) (backtrace (ert--record-backtrace)) (infos (reverse ert--infos))) *************** *** 737,742 **** --- 758,767 ---- (make-ert-test-quit :condition condition :backtrace backtrace :infos infos)) + (skipped + (make-ert-test-skipped :condition condition + :backtrace backtrace + :infos infos)) (failed (make-ert-test-failed :condition condition :backtrace backtrace *************** *** 774,781 **** ;; and consider it in `ert--run-test-debugger'? (debug-ignored-errors nil) (ert--infos '())) (funcall (ert-test-body (ert--test-execution-info-test ! test-execution-info)))))) (ert-pass)) (setf (ert--test-execution-info-result test-execution-info) (make-ert-test-passed)) --- 799,808 ---- ;; and consider it in `ert--run-test-debugger'? (debug-ignored-errors nil) (ert--infos '())) + (fset 'skip-if 'ert--skip-if) (funcall (ert-test-body (ert--test-execution-info-test ! test-execution-info))) ! (unintern 'skip-if nil)))) (ert-pass)) (setf (ert--test-execution-info-result test-execution-info) (make-ert-test-passed)) *************** *** 862,868 **** nil -- Never matches. t -- Always matches. ! :failed, :passed -- Matches corresponding results. \(and TYPES...\) -- Matches if all TYPES match. \(or TYPES...\) -- Matches if some TYPES match. \(not TYPE\) -- Matches if TYPE does not match. --- 889,895 ---- nil -- Never matches. t -- Always matches. ! :failed, :passed, :skipped -- Matches corresponding results. \(and TYPES...\) -- Matches if all TYPES match. \(or TYPES...\) -- Matches if some TYPES match. \(not TYPE\) -- Matches if TYPE does not match. *************** *** 875,880 **** --- 902,908 ---- ((member t) t) ((member :failed) (ert-test-failed-p result)) ((member :passed) (ert-test-passed-p result)) + ((member :skipped) (ert-test-skipped-p result)) (cons (cl-destructuring-bind (operator &rest operands) result-type (cl-ecase operator *************** *** 899,905 **** (defun ert-test-result-expected-p (test result) "Return non-nil if TEST's expected result type matches RESULT." ! (ert-test-result-type-p result (ert-test-expected-result-type test))) (defun ert-select-tests (selector universe) "Return a list of tests that match SELECTOR. --- 927,935 ---- (defun ert-test-result-expected-p (test result) "Return non-nil if TEST's expected result type matches RESULT." ! (or ! (ert-test-result-type-p result :skipped) ! (ert-test-result-type-p result (ert-test-expected-result-type test)))) (defun ert-select-tests (selector universe) "Return a list of tests that match SELECTOR. *************** *** 1085,1090 **** --- 1115,1121 ---- (passed-unexpected 0) (failed-expected 0) (failed-unexpected 0) + (skipped 0) (start-time nil) (end-time nil) (aborted-p nil) *************** *** 1103,1112 **** (+ (ert--stats-passed-unexpected stats) (ert--stats-failed-unexpected stats))) (defun ert-stats-completed (stats) "Number of tests in STATS that have run so far." (+ (ert-stats-completed-expected stats) ! (ert-stats-completed-unexpected stats))) (defun ert-stats-total (stats) "Number of tests in STATS, regardless of whether they have run yet." --- 1134,1148 ---- (+ (ert--stats-passed-unexpected stats) (ert--stats-failed-unexpected stats))) + (defun ert-stats-skipped (stats) + "Number of tests in STATS that have skipped." + (ert--stats-skipped stats)) + (defun ert-stats-completed (stats) "Number of tests in STATS that have run so far." (+ (ert-stats-completed-expected stats) ! (ert-stats-completed-unexpected stats) ! (ert-stats-skipped stats))) (defun ert-stats-total (stats) "Number of tests in STATS, regardless of whether they have run yet." *************** *** 1138,1143 **** --- 1174,1181 ---- (cl-incf (ert--stats-passed-expected stats) d)) (ert-test-failed (cl-incf (ert--stats-failed-expected stats) d)) + (ert-test-skipped + (cl-incf (ert--stats-skipped stats) d)) (null) (ert-test-aborted-with-non-local-exit) (ert-test-quit)) *************** *** 1146,1151 **** --- 1184,1191 ---- (cl-incf (ert--stats-passed-unexpected stats) d)) (ert-test-failed (cl-incf (ert--stats-failed-unexpected stats) d)) + (ert-test-skipped + (cl-incf (ert--stats-skipped stats) d)) (null) (ert-test-aborted-with-non-local-exit) (ert-test-quit))))) *************** *** 1240,1245 **** --- 1280,1286 ---- (let ((s (cl-etypecase result (ert-test-passed ".P") (ert-test-failed "fF") + (ert-test-skipped "sS") (null "--") (ert-test-aborted-with-non-local-exit "aA") (ert-test-quit "qQ")))) *************** *** 1252,1257 **** --- 1293,1299 ---- (let ((s (cl-etypecase result (ert-test-passed '("passed" "PASSED")) (ert-test-failed '("failed" "FAILED")) + (ert-test-skipped '("skipped" "SKIPPED")) (null '("unknown" "UNKNOWN")) (ert-test-aborted-with-non-local-exit '("aborted" "ABORTED")) (ert-test-quit '("quit" "QUIT"))))) *************** *** 1318,1325 **** (run-ended (cl-destructuring-bind (stats abortedp) event-args (let ((unexpected (ert-stats-completed-unexpected stats)) ! (expected-failures (ert--stats-failed-expected stats))) ! (message "\n%sRan %s tests, %s results as expected%s (%s)%s\n" (if (not abortedp) "" "Aborted: ") --- 1360,1368 ---- (run-ended (cl-destructuring-bind (stats abortedp) event-args (let ((unexpected (ert-stats-completed-unexpected stats)) ! (skipped (ert-stats-skipped stats)) ! (expected-failures (ert--stats-failed-expected stats))) ! (message "\n%sRan %s tests, %s results as expected%s%s (%s)%s\n" (if (not abortedp) "" "Aborted: ") *************** *** 1328,1333 **** --- 1371,1379 ---- (if (zerop unexpected) "" (format ", %s unexpected" unexpected)) + (if (zerop skipped) + "" + (format ", %s skipped" skipped)) (ert--format-time-iso8601 (ert--stats-end-time stats)) (if (zerop expected-failures) "" *************** *** 1340,1345 **** --- 1386,1400 ---- (message "%9s %S" (ert-string-for-test-result result nil) (ert-test-name test)))) + (message "%s" "")) + (unless (zerop skipped) + (message "%s skipped results:" skipped) + (cl-loop for test across (ert--stats-tests stats) + for result = (ert-test-most-recent-result test) do + (when (ert-test-result-type-p result :skipped) + (message "%9s %S" + (ert-string-for-test-result result nil) + (ert-test-name test)))) (message "%s" ""))))) (test-started ) *************** *** 1562,1576 **** (ert--insert-human-readable-selector (ert--stats-selector stats)) (insert "\n") (insert ! (format (concat "Passed: %s\n" ! "Failed: %s\n" ! "Total: %s/%s\n\n") (ert--results-format-expected-unexpected (ert--stats-passed-expected stats) (ert--stats-passed-unexpected stats)) (ert--results-format-expected-unexpected (ert--stats-failed-expected stats) (ert--stats-failed-unexpected stats)) run-count (ert-stats-total stats))) (insert --- 1617,1633 ---- (ert--insert-human-readable-selector (ert--stats-selector stats)) (insert "\n") (insert ! (format (concat "Passed: %s\n" ! "Failed: %s\n" ! "Skipped: %s\n" ! "Total: %s/%s\n\n") (ert--results-format-expected-unexpected (ert--stats-passed-expected stats) (ert--stats-passed-unexpected stats)) (ert--results-format-expected-unexpected (ert--stats-failed-expected stats) (ert--stats-failed-unexpected stats)) + (ert-stats-skipped stats) run-count (ert-stats-total stats))) (insert --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 21 12:53:26 2013 Received: (at 9803) by debbugs.gnu.org; 21 Oct 2013 16:53:26 +0000 Received: from localhost ([127.0.0.1]:32821 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYIjO-0004t5-4J for submit@debbugs.gnu.org; Mon, 21 Oct 2013 12:53:26 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:17138) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYIjM-0004ss-Ca for 9803@debbugs.gnu.org; Mon, 21 Oct 2013 12:53:24 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxLCX/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFFxLCX/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="35989110" Received: from 69-196-176-151.dsl.teksavvy.com (HELO pastel.home) ([69.196.176.151]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 21 Oct 2013 12:53:18 -0400 Received: by pastel.home (Postfix, from userid 20848) id CFE866001B; Mon, 21 Oct 2013 12:53:14 -0400 (EDT) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#9803: [PATCH] Add ERT option to skip test Message-ID: References: <87vc0usnrj.fsf@gmx.de> <87txgcyqyk.fsf@gmx.de> <87ppqywtjk.fsf@gmx.de> Date: Mon, 21 Oct 2013 12:53:14 -0400 In-Reply-To: <87ppqywtjk.fsf@gmx.de> (Michael Albinus's message of "Mon, 21 Oct 2013 17:08:31 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 9803 Cc: Glenn Morris , 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > Well, I've made a change to call (fset 'skip-if 'ert--skip-if) in > ert--run-test-internal. After running the test, it is reverted by > (unintern 'skip-if nil). Yuck! > Therefore, `skip-if' is visible only inside tests defined with > `ert-deftest'. Not "inside" but "during". I.e. it can still affect any code run during the tests. > If this is acceptable, I could apply this change also for > `should', `should-not' and `should-error'. No, better leave them as always-global. > I've tried to change it as proposed by Stefan, but I'm too stupid to > manage all this sophisticated cl-* stuff :-( What have you tried and how did it fail? Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 21 13:02:14 2013 Received: (at 9803) by debbugs.gnu.org; 21 Oct 2013 17:02:14 +0000 Received: from localhost ([127.0.0.1]:32832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYIrt-00057B-7o for submit@debbugs.gnu.org; Mon, 21 Oct 2013 13:02:13 -0400 Received: from mout.gmx.net ([212.227.17.21]:49389) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYIrq-00056v-8V for 9803@debbugs.gnu.org; Mon, 21 Oct 2013 13:02:11 -0400 Received: from detlef.gmx.de ([93.202.58.207]) by mail.gmx.com (mrgmx002) with ESMTPS (Nemesis) id 0MOx4J-1Vbr6k3UiF-006O3l for <9803@debbugs.gnu.org>; Mon, 21 Oct 2013 19:02:02 +0200 From: Michael Albinus To: Stefan Monnier Subject: Re: bug#9803: [PATCH] Add ERT option to skip test References: <87vc0usnrj.fsf@gmx.de> <87txgcyqyk.fsf@gmx.de> <87ppqywtjk.fsf@gmx.de> Date: Mon, 21 Oct 2013 19:02:00 +0200 In-Reply-To: (Stefan Monnier's message of "Mon, 21 Oct 2013 12:53:14 -0400") Message-ID: <87y55m36d3.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:VAJEdMtEyPNsvg1pvH3tD5wCTA5g/DXTg04eXZP094AMXJ92kSp HhB3DlutqNAgE0GovDuY+9USxOEu1HsW5vd+dgcm6lJintOn2TQBUA+slKHHCwfro6O+Vz+ YjlFKTDl+KqtAZTyJkAQuU4iXFdf65fkwHxsAsWGdMFM7lBklB2kqblvYc/SmLdQvfOktNQ ZY6a4+j90bnAUdDHyCWeQ== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9803 Cc: Glenn Morris , 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Stefan Monnier writes: >> I've tried to change it as proposed by Stefan, but I'm too stupid to >> manage all this sophisticated cl-* stuff :-( > > What have you tried and how did it fail? I've tried a kind of `letf'; this failed because it replaces only function calls of functions which exist already. Does not work, because `skip-if' shall not exist. Then I did traverse `remaining' in `ert--parse-keys-and-body', replacing all `skip-if' occurences in the car's by `ert--skip-if'. This did work somehow, but only if `skip-if' is called on the top-level of the body of an ert test. Parsing the whole structure might be possible, but I don't know a respective function/macro, and writing an own recursive parsing seems to expensive to me. > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 21 15:23:31 2013 Received: (at 9803) by debbugs.gnu.org; 21 Oct 2013 19:23:31 +0000 Received: from localhost ([127.0.0.1]:33148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYL4d-0002NO-2n for submit@debbugs.gnu.org; Mon, 21 Oct 2013 15:23:31 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:8266) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYL4a-0002N7-WB for 9803@debbugs.gnu.org; Mon, 21 Oct 2013 15:23:29 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: At0KABK/CFFFxLCX/2dsb2JhbABEvg0EAnsXc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: At0KABK/CFFFxLCX/2dsb2JhbABEvg0EAnsXc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="36005760" Received: from 69-196-176-151.dsl.teksavvy.com (HELO pastel.home) ([69.196.176.151]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 21 Oct 2013 15:23:23 -0400 Received: by pastel.home (Postfix, from userid 20848) id C929760026; Mon, 21 Oct 2013 15:23:22 -0400 (EDT) From: Stefan Monnier To: Michael Albinus Subject: Re: bug#9803: [PATCH] Add ERT option to skip test Message-ID: References: <87vc0usnrj.fsf@gmx.de> <87txgcyqyk.fsf@gmx.de> <87ppqywtjk.fsf@gmx.de> <87y55m36d3.fsf@gmx.de> Date: Mon, 21 Oct 2013 15:23:22 -0400 In-Reply-To: <87y55m36d3.fsf@gmx.de> (Michael Albinus's message of "Mon, 21 Oct 2013 19:02:00 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 9803 Cc: Glenn Morris , 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > I've tried a kind of `letf'; this failed because it replaces only > function calls of functions which exist already. Does not work, because > `skip-if' shall not exist. You want to use either `cl-flet' or `cl-macrolet', depending on whether you want to define skip-if as a local function or a local macro. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 22 04:24:03 2013 Received: (at 9803) by debbugs.gnu.org; 22 Oct 2013 08:24:03 +0000 Received: from localhost ([127.0.0.1]:34253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYXFz-0003zs-5P for submit@debbugs.gnu.org; Tue, 22 Oct 2013 04:24:03 -0400 Received: from mout.gmx.net ([212.227.15.18]:49885) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYXFw-0003zK-BP for 9803@debbugs.gnu.org; Tue, 22 Oct 2013 04:24:01 -0400 Received: from detlef.gmx.de ([93.202.57.254]) by mail.gmx.com (mrgmx001) with ESMTPS (Nemesis) id 0MX16a-1VBRy11BHo-00Vtrv for <9803@debbugs.gnu.org>; Tue, 22 Oct 2013 10:23:54 +0200 From: Michael Albinus To: Stefan Monnier Subject: Re: bug#9803: [PATCH] Add ERT option to skip test References: <87vc0usnrj.fsf@gmx.de> <87txgcyqyk.fsf@gmx.de> <87ppqywtjk.fsf@gmx.de> <87y55m36d3.fsf@gmx.de> Date: Tue, 22 Oct 2013 10:23:50 +0200 In-Reply-To: (Stefan Monnier's message of "Mon, 21 Oct 2013 15:23:22 -0400") Message-ID: <87a9i1af3d.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:OLvrkHWDv50TWEUUG1+rcxvBeC9TK22usSVNCzJL3ePJSHgdB3Q XRR27JPT7Cna00HE9k8UqDZsVuSNh2hA8iK9icefa0cZXUokGiV4KCXAbc7UmSrMTGRZFwV jANKLARVDmbb8mTp4oxKiJXmMG8hgRTotpr/DyGFL4F5TSEhPB2YTFyCJmytBx6cmJqKZwL 7vgvPeRxje9jmOn5Ud7Pw== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9803 Cc: Glenn Morris , 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Stefan Monnier writes: > You want to use either `cl-flet' or `cl-macrolet', depending on whether > you want to define skip-if as a local function or a local macro. `cl-macrolet' does it, thanks! I will also handle `should', `should-not' and `should-error' this way. Meanwhile I'm thinking, we should introduce `skip-unless' instead of `skip-if'. This would allow to catch errors, like this: (skip-unless (ignore-errors (a-test-which-might-raise-a-signal))) We could even move `ignore-errors' into `skip-unless'. Opinions? > Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 23 08:22:10 2013 Received: (at 9803) by debbugs.gnu.org; 23 Oct 2013 12:22:11 +0000 Received: from localhost ([127.0.0.1]:37270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYxRy-0004te-5e for submit@debbugs.gnu.org; Wed, 23 Oct 2013 08:22:10 -0400 Received: from mout.gmx.net ([212.227.17.22]:59995) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VYxRv-0004t8-8p for 9803@debbugs.gnu.org; Wed, 23 Oct 2013 08:22:08 -0400 Received: from uw001237 ([84.135.116.81]) by mail.gmx.com (mrgmx102) with ESMTPA (Nemesis) id 0MW9TR-1VEtJx2Kc5-00XJ6n for <9803@debbugs.gnu.org>; Wed, 23 Oct 2013 14:22:01 +0200 From: Michael Albinus To: Stefan Monnier , 9803@debbugs.gnu.org Subject: Re: bug#9803: [PATCH] Add ERT option to skip test In-Reply-To: <87a9i1af3d.fsf@gmx.de> (Michael Albinus's message of "Tue, 22 Oct 2013 10:23:50 +0200") References: <87vc0usnrj.fsf@gmx.de> <87txgcyqyk.fsf@gmx.de> <87ppqywtjk.fsf@gmx.de> <87y55m36d3.fsf@gmx.de> <87a9i1af3d.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Date: Wed, 23 Oct 2013 14:21:59 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:CfV6zS6mqCBv6wJ25aqr4FdLiZBnBKFFqj3TE105g5IdIJc+35O Sz1SIH+caCDbyA1yIxEwYNMNDf9eMllpKYROQDkc5E/haTXjCKyG6KqjieFn3n0gvol1RvW LHdTqrJGMbuHhlnnbtQkqx52VGy5B894vG+K9h4KiDMHr0hTvqc6KC+mNfW/WuMaOD4XNtB popAvAz0vn2nqmF15ZobA== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9803 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Michael Albinus writes: > Stefan Monnier writes: > >> You want to use either `cl-flet' or `cl-macrolet', depending on whether >> you want to define skip-if as a local function or a local macro. > > `cl-macrolet' does it, thanks! I will also handle `should', `should-not' > and `should-error' this way. Well, it works only for tests which use `should', `should-not' and `should-error' in the body of `ert-deftest'. Unfortunately, there are several tests which use helper functions, calling `should' and friends. For those tests it doesn't work this way. Since this is not related to the `skip-unless' check, I will commit just a patch introducing this macro. Changing the scope of `should', `should-not' and `should-error' could be fixed later. >> Stefan Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 24 03:47:07 2013 Received: (at 9803) by debbugs.gnu.org; 24 Oct 2013 07:47:07 +0000 Received: from localhost ([127.0.0.1]:40104 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZFdL-0004l7-5K for submit@debbugs.gnu.org; Thu, 24 Oct 2013 03:47:07 -0400 Received: from mout.gmx.net ([212.227.15.18]:57284) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZFdI-0004kZ-VN for 9803@debbugs.gnu.org; Thu, 24 Oct 2013 03:47:05 -0400 Received: from detlef.gmx.de ([87.146.62.185]) by mail.gmx.com (mrgmx103) with ESMTPS (Nemesis) id 0Md31i-1VI8S82cBG-00IFi6 for <9803@debbugs.gnu.org>; Thu, 24 Oct 2013 09:46:58 +0200 From: Michael Albinus To: 9803@debbugs.gnu.org Subject: Re: bug#9803: [PATCH] Add ERT option to skip test References: <87vc0usnrj.fsf@gmx.de> <87txgcyqyk.fsf@gmx.de> <87ppqywtjk.fsf@gmx.de> <87y55m36d3.fsf@gmx.de> <87a9i1af3d.fsf@gmx.de> Date: Thu, 24 Oct 2013 09:46:56 +0200 In-Reply-To: (Michael Albinus's message of "Wed, 23 Oct 2013 14:21:59 +0200") Message-ID: <87d2mvrtzj.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K0:GM2g0qO7IcSOnqrUtkFLRcLAZOReKvwkJYWlkqRh3W4JJvmwyQw /SQU/SWX73/P5HZfeCNjYGs5zCoNsNzb008LUTEA1Ag6/ayCYir44Pyf7stAx1rCMjYFAG6 L8W96lWXVGzpe9var4cJmq1WFKFepylEOR7fGx0aYvAkM7ayC6INXSrXnaqVDDxVR+cHqQ1 37MDTMJhtXwG5ETEucscQ== X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 9803 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Hi, I've committed the final patch to the trunk. Best regards, Michael. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 24 04:00:28 2013 Received: (at 9803) by debbugs.gnu.org; 24 Oct 2013 08:00:28 +0000 Received: from localhost ([127.0.0.1]:40117 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZFqE-000552-SK for submit@debbugs.gnu.org; Thu, 24 Oct 2013 04:00:27 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:46622 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZFqB-00054r-PP for 9803@debbugs.gnu.org; Thu, 24 Oct 2013 04:00:24 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1VZFqA-00060K-DF; Thu, 24 Oct 2013 04:00:22 -0400 From: Glenn Morris To: Michael Albinus Subject: Re: bug#9803: [PATCH] Add ERT option to skip test References: <87vc0usnrj.fsf@gmx.de> <87txgcyqyk.fsf@gmx.de> <87ppqywtjk.fsf@gmx.de> <87y55m36d3.fsf@gmx.de> <87a9i1af3d.fsf@gmx.de> <87d2mvrtzj.fsf@gmx.de> X-Spook: wire transfer PLO Abbas Waco, Texas S Box benelux BCCI X-Ran: vPq[%MI74m,F4GCYl;'6Yr.n1,C^Sl!1PMCcG~`vM.THq}\_[eq{!mjRg)LCf0QQ}.`*'B X-Hue: blue X-Debbugs-No-Ack: yes X-Attribution: GM Date: Thu, 24 Oct 2013 04:00:22 -0400 In-Reply-To: <87d2mvrtzj.fsf@gmx.de> (Michael Albinus's message of "Thu, 24 Oct 2013 09:46:56 +0200") Message-ID: <5wwql3qesp.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -4.7 (----) X-Debbugs-Envelope-To: 9803 Cc: 9803@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.7 (----) Michael Albinus wrote: > I've committed the final patch to the trunk. Fantastic, thank you. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 24 04:00:36 2013 Received: (at control) by debbugs.gnu.org; 24 Oct 2013 08:00:36 +0000 Received: from localhost ([127.0.0.1]:40120 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZFqN-00055U-4A for submit@debbugs.gnu.org; Thu, 24 Oct 2013 04:00:36 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:46625 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VZFqI-00055E-7W for control@debbugs.gnu.org; Thu, 24 Oct 2013 04:00:31 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1VZFqH-0006e5-M1 for control@debbugs.gnu.org; Thu, 24 Oct 2013 04:00:29 -0400 Date: Thu, 24 Oct 2013 04:00:29 -0400 Message-Id: Subject: control message for bug 9803 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -5.4 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.4 (-----) close 9803 24.4 From unknown Fri Jun 20 18:03:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 21 Nov 2013 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator