Mercurial > emacs
annotate test/cedet/semantic-utest-c.el @ 112379:b14f98859016
Merge: build from gnulib a bit better; document autoreconf.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Wed, 19 Jan 2011 15:59:52 -0800 |
parents | ef719132ddfa |
children |
rev | line source |
---|---|
105267 | 1 ;;; semantic-utest-c.el --- C based parsing tests. |
2 | |
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
3 ;; Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
105267 | 4 |
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com> | |
105301 | 6 |
7 ;; This file is part of GNU Emacs. | |
105267 | 8 |
105301 | 9 ;; GNU Emacs is free software: you can redistribute it and/or modify |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation, either version 3 of the License, or | |
12 ;; (at your option) any later version. | |
105267 | 13 |
105301 | 14 ;; GNU Emacs is distributed in the hope that it will be useful, |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
105267 | 18 |
19 ;; You should have received a copy of the GNU General Public License | |
105301 | 20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
105267 | 21 |
22 ;;; Commentary: | |
23 ;; | |
24 ;; Run some C based parsing tests. | |
25 | |
26 (require 'semantic) | |
27 | |
28 (defvar semantic-utest-c-comparisons | |
29 '( ("testsppreplace.c" . "testsppreplaced.c") | |
30 ) | |
31 "List of files to parse and compare against eachother.") | |
32 | |
33 ;;; Code: | |
34 ;;;###autoload | |
35 (defun semantic-utest-c () | |
36 "Run parsing test for C from the test directory." | |
37 (interactive) | |
38 (dolist (fp semantic-utest-c-comparisons) | |
39 (let* ((sem (locate-library "semantic")) | |
40 (sdir (file-name-directory sem)) | |
41 (semantic-lex-c-nested-namespace-ignore-second nil) | |
42 (tags-actual | |
43 (save-excursion | |
44 (set-buffer (find-file-noselect (expand-file-name (concat "tests/" (car fp)) sdir))) | |
45 (semantic-clear-toplevel-cache) | |
46 (semantic-fetch-tags))) | |
47 (tags-expected | |
48 (save-excursion | |
49 (set-buffer (find-file-noselect (expand-file-name (concat "tests/" (cdr fp)) sdir))) | |
50 (semantic-clear-toplevel-cache) | |
51 (semantic-fetch-tags)))) | |
52 ;; Now that we have the tags, compare them for SPP accuracy. | |
53 (dolist (tag tags-actual) | |
54 (if (and (semantic-tag-of-class-p tag 'variable) | |
55 (semantic-tag-variable-constant-p tag)) | |
56 nil ; skip the macros. | |
57 (if (semantic-tag-similar-with-subtags-p tag (car tags-expected)) | |
58 (setq tags-expected (cdr tags-expected)) | |
59 (with-mode-local c-mode | |
60 (error "Found: >> %s << Expected: >> %s <<" | |
61 (semantic-format-tag-prototype tag nil t) | |
62 (semantic-format-tag-prototype (car tags-expected) nil t) | |
63 ))) | |
64 )) | |
65 ;; Passed? | |
66 (message "PASSED!") | |
67 ))) | |
68 | |
69 | |
70 (provide 'semantic-utest-c) | |
105377 | 71 |
105267 | 72 ;;; semantic-utest-c.el ends here |