From 2448a55ba151f05bea77c14d58b2bf6874d2934c Mon Sep 17 00:00:00 2001 From: David Engster Date: Thu, 1 Dec 2011 20:13:55 +0100 Subject: [PATCH] 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 0f027bffdc8..a3f324772ed 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))) -- 2.39.5