emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master e352538: Fix Testcover bug in handling of vectors c


From: Gemini Lasswell
Subject: [Emacs-diffs] master e352538: Fix Testcover bug in handling of vectors containing dotted lists
Date: Mon, 2 Apr 2018 12:43:12 -0400 (EDT)

branch: master
commit e3525385a87c92fdca6b3cf929797a731c688a3f
Author: Gemini Lasswell <address@hidden>
Commit: Gemini Lasswell <address@hidden>

    Fix Testcover bug in handling of vectors containing dotted lists
    
    * lisp/emacs-lisp/testcover.el (testcover-analyze-coverage-compose):
    Handle dotted lists. Fix bug#30909.
    * test/lisp/emacs-lisp/testcover-resources/testcases.el:
    (dotted-list-in-vector-bug-30909): New test case.
    (quotes-within-backquotes-bug-25316, dotted-backquote)
    (quoted-backquote, backquoted-vector-bug-25316)
    (vector-in-macro-spec-bug, backquoted-dotted-alist): Change
    docstrings to mention analyzing code instead of reinstrumenting
    it.
---
 lisp/emacs-lisp/testcover.el                          |  8 +++++---
 test/lisp/emacs-lisp/testcover-resources/testcases.el | 19 +++++++++++++------
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el
index e0d2797..d48c79c 100644
--- a/lisp/emacs-lisp/testcover.el
+++ b/lisp/emacs-lisp/testcover.el
@@ -644,9 +644,11 @@ are 1value."
   "Analyze a list of FORMS for code coverage using FUNC.
 The list is 1valued if all of its constituent elements are also 1valued."
   (let ((result '1value))
-    (dolist (form forms)
-      (let ((val (funcall func form)))
-        (setq result (testcover-coverage-combine result val))))
+    (while (consp forms)
+      (setq result (testcover-coverage-combine result (funcall func (car 
forms))))
+      (setq forms (cdr forms)))
+    (when forms
+      (setq result (testcover-coverage-combine result (funcall func forms))))
     result))
 
 (defun testcover-analyze-coverage-backquote (bq-list)
diff --git a/test/lisp/emacs-lisp/testcover-resources/testcases.el 
b/test/lisp/emacs-lisp/testcover-resources/testcases.el
index c9703b0..69ef5b5 100644
--- a/test/lisp/emacs-lisp/testcover-resources/testcases.el
+++ b/test/lisp/emacs-lisp/testcover-resources/testcases.el
@@ -226,7 +226,7 @@
 (should-not (testcover-testcase-cc nil))
 
 ;; ==== quotes-within-backquotes-bug-25316 ====
-"Forms to instrument are found within quotes within backquotes."
+"Forms to analyze are found within quotes within backquotes."
 ;; ====
 (defun testcover-testcase-make-list ()
   (list 'defun 'defvar))
@@ -377,7 +377,7 @@
 (should-error (testcover-testcase-thing 3))
 
 ;; ==== dotted-backquote ====
-"Testcover correctly instruments dotted backquoted lists."
+"Testcover can analyze code inside dotted backquoted lists."
 ;; ====
 (defun testcover-testcase-dotted-bq (flag extras)
   (let* ((bq
@@ -388,7 +388,7 @@
 (should (equal '(a b c d e) (testcover-testcase-dotted-bq t '(d e))))
 
 ;; ==== quoted-backquote ====
-"Testcover correctly instruments the quoted backquote symbol."
+"Testcover correctly handles the quoted backquote symbol."
 ;; ====
 (defun testcover-testcase-special-symbols ()
   (list '\` '\, '\,@))
@@ -396,7 +396,7 @@
 (should (equal '(\` \, \,@) (testcover-testcase-special-symbols)))
 
 ;; ==== backquoted-vector-bug-25316 ====
-"Testcover reinstruments within backquoted vectors."
+"Testcover can analyze code within backquoted vectors."
 ;; ====
 (defun testcover-testcase-vec (a b c)
   `[,a%%% ,(list b%%% c%%%)%%%]%%%)
@@ -411,8 +411,15 @@
 (should (equal '([[4 5] 6]) (testcover-testcase-vec-in-list 4 5 6)))
 (should (equal '([100]) (testcover-testcase-vec-arg 100)))
 
+;; ==== dotted-list-in-vector-bug-30909 ====
+"Testcover can analyze dotted pairs within vectors."
+;; ====
+(defun testcover-testcase-vectors-with-dotted-pairs ()
+  (equal [(1 . "x")] [(1 2 . "y")])%%%)
+(should-not (testcover-testcase-vectors-with-dotted-pairs))
+
 ;; ==== vector-in-macro-spec-bug-25316 ====
-"Testcover reinstruments within vectors."
+"Testcover can analyze code inside vectors."
 ;; ====
 (defmacro testcover-testcase-nth-case (arg vec)
   (declare (indent 1)
@@ -466,7 +473,7 @@ regarding the odd-looking coverage result for the quoted 
form."
 (should (equal (testcover-testcase-use-thing) 15))
 
 ;; ==== backquoted-dotted-alist ====
-"Testcover can instrument a dotted alist constructed with backquote."
+"Testcover can analyze a dotted alist constructed with backquote."
 ;; ====
 (defun testcover-testcase-make-alist (expr entries)
   `((0 . ,expr%%%) . ,entries%%%)%%%)



reply via email to

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