Fix rst-mode deprecated keybindings
[emacs.git] / test / cedet / semantic-utest-c.el
blobe42ff1aadd258361f20b8b74cbdf69b8f00cf5ad
1 ;;; semantic-utest-c.el --- C based parsing tests.
3 ;; Copyright (C) 2008-2014 Free Software Foundation, Inc.
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
7 ;; This file is part of GNU Emacs.
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.
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.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 ;;; Commentary:
24 ;; Run some C based parsing tests.
26 (require 'semantic)
28 (defvar semantic-utest-c-comparisons
29 '( ("testsppreplace.c" . "testsppreplaced.c")
31 "List of files to parse and compare against each other.")
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 )))
65 ;; Passed?
66 (message "PASSED!")
67 )))
70 (provide 'semantic-utest-c)
72 ;;; semantic-utest-c.el ends here