]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix unit testing for several tests and do better error checking.
authorDavid Engster <dengste@eml.cc>
Thu, 1 Dec 2011 19:13:55 +0000 (20:13 +0100)
committerEdward John Steere <edward.steere@gmail.com>
Wed, 25 Jan 2017 18:13:42 +0000 (20:13 +0200)
* 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

index 0f027bffdc8c0762d350014ee2dbcfdc3edee932..a3f324772edc3599cce3dada4362bc7aa8de9df1 100644 (file)
@@ -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)))