emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/merge-cedet-tests 2448a55 268/316: Fix unit testin


From: Edward John Steere
Subject: [Emacs-diffs] scratch/merge-cedet-tests 2448a55 268/316: Fix unit testing for several tests and do better error checking.
Date: Sat, 28 Jan 2017 09:10:10 +0000 (UTC)

branch: scratch/merge-cedet-tests
commit 2448a55ba151f05bea77c14d58b2bf6874d2934c
Author: David Engster <address@hidden>
Commit: Edward John Steere <address@hidden>

    Fix unit testing for several tests and do better error checking.
    
    * semantic/lex-spp-utests.el (semantic-lex-spp-write-utest):
    * tests/cedet-utests.el (cedet-utest-eieio-classloader): Throw
      error if we cannot locate test files.
    
    * semantic/utest-c.el (semantic-utest-c-compare)
      (semantic-utest-c-conditionals):
    * semantic/lex-spp-utest.el (semantic-lex-spp-write-utest): Adapt
      to new directory structure and do better error checking to avoid
      silent failures in the future.
---
 test/manual/cedet/cedet/semantic/utest-c.el |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/test/manual/cedet/cedet/semantic/utest-c.el 
b/test/manual/cedet/cedet/semantic/utest-c.el
index 0f027bf..a3f3247 100644
--- a/test/manual/cedet/cedet/semantic/utest-c.el
+++ b/test/manual/cedet/cedet/semantic/utest-c.el
@@ -49,17 +49,24 @@ The first file is full of SPP macros.
 The second file is full of raw code that the macros should
 expand to."
   (dolist (fp semantic-utest-c-comparisons)
-    (let* ((sem (locate-library "semantic"))
+    (let* ((sem (or (locate-library "cedet/semantic/utest-c")
+                   (error "Cannot locate library 'cedet/semantic/utest-c'.")))
           (sdir (file-name-directory sem))
+          (filename1 (expand-file-name (concat "tests/" (car fp)) sdir))
+          (filename2 (expand-file-name (concat "tests/" (cdr fp)) sdir))
           (semantic-lex-c-nested-namespace-ignore-second nil)
           (tags-actual
            (save-excursion
-             (set-buffer (find-file-noselect (expand-file-name (concat 
"tests/" (car fp)) sdir)))
+             (unless (file-exists-p filename1)
+               (error "Cannot load %s." filename1))
+             (set-buffer (find-file-noselect filename1))
              (semantic-clear-toplevel-cache)
              (semantic-fetch-tags)))
           (tags-expected
            (save-excursion
-             (set-buffer (find-file-noselect (expand-file-name (concat 
"tests/" (cdr fp)) sdir)))
+             (unless (file-exists-p filename2)
+               (error "Cannot load %s." filename2))
+             (set-buffer (find-file-noselect filename2))
              (semantic-clear-toplevel-cache)
              (semantic-fetch-tags))))
       ;; Now that we have the tags, compare them for SPP accuracy.
@@ -85,11 +92,15 @@ those with PASS in the name will pass."
       (message "\nNOTICE: XEmacs 21 doesn't support a recent enough version of 
hideif to run C contional tests.\n")
 
     (dolist (fp semantic-utest-c-conditionals)
-      (let* ((sem (locate-library "semantic"))
+      (let* ((sem (or (locate-library "cedet/semantic/utest-c")
+                     (error "Cannot locate library 
'cedet/semantic/utest-c'.")))
             (sdir (file-name-directory sem))
+            (filename (expand-file-name (concat "tests/" fp) sdir))
             (semantic-lex-c-nested-namespace-ignore-second nil)
             (tags-actual
              (save-excursion
+               (unless (file-exists-p filename)
+                 (error "Cannot load %s." filename))
                (set-buffer (find-file-noselect (expand-file-name (concat 
"tests/" fp) sdir)))
                (semantic-clear-toplevel-cache)
                (semantic-fetch-tags)))



reply via email to

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