[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/merge-cedet-tests 66c8eb7 256/316: Remove useless
From: |
Edward John Steere |
Subject: |
[Emacs-diffs] scratch/merge-cedet-tests 66c8eb7 256/316: Remove useless generated skeleton and old NEWS |
Date: |
Fri, 27 Jan 2017 20:03:45 +0000 (UTC) |
branch: scratch/merge-cedet-tests
commit 66c8eb7424b372ef8d4dd9232232490fdab3c2c6
Author: David Engster <address@hidden>
Commit: Edward John Steere <address@hidden>
Remove useless generated skeleton and old NEWS
* test/manual/cedet/cedet/semantic/fmt-utest.el Removed useless
generated skeleton grammar. Move old NEWS files and
semantic-fmt-utest.
---
test/manual/cedet/cedet/semantic/fmt-utest.el | 161 +++++++++++++++++++++++++
1 file changed, 161 insertions(+)
diff --git a/test/manual/cedet/cedet/semantic/fmt-utest.el
b/test/manual/cedet/cedet/semantic/fmt-utest.el
new file mode 100644
index 0000000..14c329b
--- /dev/null
+++ b/test/manual/cedet/cedet/semantic/fmt-utest.el
@@ -0,0 +1,161 @@
+;;; semantic-fmt-utest.el --- Parsing / Formatting tests
+;;
+;; Copyright (C) 2012 Eric M. Ludlam
+;;
+;; Author: Eric M. Ludlam <address@hidden>
+;;
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program; see the file COPYING. If not, write to
+;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
+
+;;; Commentary:
+;;
+;; Unit tests for the formatting feature.
+;;
+;; Using test code from the tests source directory, parse the source
+;; file. After parsing, read the comments for each signature, and
+;; make sure that the semantic-tag-format-* functions in question
+;; created the desired output.
+
+(require 'cedet-utests)
+(require 'semantic)
+(require 'semantic-format)
+
+;;; Code:
+
+(defvar semantic-fmt-utest-file-list
+ '("tests/test-fmt.cpp"
+ "tests/test-fmt.el"
+ )
+ "List of files to run unit tests in.")
+
+(defvar semantic-fmt-utest-error-log-list nil
+ "Log errors during testing in this variable.")
+
+;;;###autoload
+(defun semantic-fmt-utest ()
+ "Visit all file entries, and run formatting test.
+Files to visit are in `semantic-fmt-utest-file-list'."
+ (interactive)
+
+ (save-current-buffer
+
+ (let ((fl semantic-fmt-utest-file-list)
+ (semantic-fmt-utest-error-log-list nil)
+ )
+
+ (cedet-utest-log-setup "PARSE/FORMAT")
+
+ (set-buffer (semantic-find-file-noselect
+ (locate-library "semantic-fmt-utest.el")))
+
+ (dolist (FILE fl)
+
+ (save-current-buffer
+ ;; Make sure we have the files we think we have.
+ (when (not (file-exists-p FILE))
+ (error "Cannot find unit test file: %s" FILE))
+
+ ;; Run the tests.
+ (let ((fb (find-buffer-visiting FILE))
+ (b (semantic-find-file-noselect FILE))
+ (num 0)
+ (tags nil))
+
+ (save-current-buffer
+ (set-buffer b)
+ (when (not (semantic-active-p))
+ (error "Cannot open %s for format tests" FILE))
+
+ ;; This will force a reparse, removing any chance of semanticdb
cache
+ ;; using stale data.
+ (semantic-clear-toplevel-cache)
+ ;; Force the reparse
+ (setq tags (semantic-fetch-tags))
+ (setq num (length tags))
+
+ (semantic-fmt-utest-log " ** Starting tests in %s"
+ (buffer-name))
+
+ (save-excursion
+ (while tags
+ (let* ((T (car tags))
+ (start (semantic-tag-end T))
+ (end (if (cdr tags)
+ (semantic-tag-start (car (cdr tags)))
+ (point-max)))
+ (TESTS nil)
+ )
+ (goto-char start)
+ ;; Scan the space between tags for all test condition
matches.
+ (while (re-search-forward "## \\([a-z-]+\\)
\"\\([^\n\"]+\\)\"$" end t)
+ (push (cons (match-string 1) (match-string 2)) TESTS))
+ (setq TESTS (nreverse TESTS))
+
+ (dolist (TST TESTS)
+ (let* ( ;; For each test, convert CAR into a
semantic-format-tag* fcn
+ (sym (intern (concat "semantic-format-tag-" (car
TST))))
+ ;; Convert the desired result from a string syntax
to a string.
+ (desired (cdr TST))
+ ;; What does the fmt function do?
+ (actual (funcall sym T))
+ )
+ (unless (string= desired actual)
+
+ (add-to-list 'semantic-fmt-utest-error-log-list
+ (list (buffer-name) (semantic-tag-name T)
+ sym)
+ )
+
+ (semantic-fmt-utest-log
+ " Failed %s/%s. Desired: %S Actual %S"
+ (semantic-tag-name T) sym
+ desired actual))))
+ )
+ (setq tags (cdr tags)))
+
+
+ (semantic-fmt-utest-log " ** Completed %d tests in %s\n"
+ num (buffer-name))
+ ))
+
+ ;; If it wasn't already in memory, whack it.
+ (when (and b (not fb))
+ (kill-buffer b)))
+ ))
+
+ (cedet-utest-log-shutdown
+ "PARSE/FORMAT"
+ (when semantic-fmt-utest-error-log-list
+ (format "%s Failures found."
+ (length semantic-fmt-utest-error-log-list))))
+ (when semantic-fmt-utest-error-log-list
+ (error "Failures found during parse/format unit tests"))
+ )))
+
+
+(defun semantic-fmt-utest-start-log ()
+ "Start up a testlog for a run."
+ ;; Redo w/ CEDET utest framework.
+ (cedet-utest-log-start "semantic: format tests"))
+
+(defun semantic-fmt-utest-log (&rest args)
+ "Log some test results.
+Pass ARGS to format to create the log message."
+ ;; Forward to CEDET utest framework.
+ (apply 'cedet-utest-log args))
+
+(provide 'semantic-fmt-utest)
+
+;;; semantic-fmt-utest.el ends here
- [Emacs-diffs] scratch/merge-cedet-tests 2c1d730 190/316: Ignore Members On Extra Tags, (continued)
- [Emacs-diffs] scratch/merge-cedet-tests 2c1d730 190/316: Ignore Members On Extra Tags, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 0ceb1ef 168/316: Integration Tests., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 816e083 151/316: (ede-detect-utest-project-list): Add test for generic VC type project. (ede-detect-utest): Add fake autoloader for VC. (ede-detect-utest-generic-vc-p): New., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 323ca78 196/316: New test file for unions., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests a40bc3f 191/316: (Cit-Android): New Require. (Cedet-Integ-Test-Gnustep): Fix Typo. (Cedet-Integ-Test-Android): New Build Type Support For Android. (Cit-Make-Dir): Allow Making Trees Of Directories. (Cit-Compile-And-Wait): Only Regenerate The Project If That Project Type Can Be Regenerated. (Cit-Compile-And-Wait-Using-Ede-Command): New Way To Build That Uses Ede Commands Instead Of Hard-Coded Make Commands., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests e267436 232/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 32b1d6c 260/316: First pass of creating a distribution., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests cdfb2f7 252/316: Tests for completiong symbols in wisent grammars., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 82a840d 244/316: Use ldflags and libs for in project libraries, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 28e2c81 239/316: (cit-remove-and-do-shared-lib): New., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 66c8eb7 256/316: Remove useless generated skeleton and old NEWS,
Edward John Steere <=
- [Emacs-diffs] scratch/merge-cedet-tests cb8b935 245/316: (cit-remove-and-do-shared-lib): Add ldlibs-local test., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 34041d4 120/316: Synchronize cedet/semantic with Emacs., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 60a3f4b 299/316: (semantic-ia-utest-file-list): add testwisent.wy, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests d8c1209 234/316: CPP integration support. Core bits copied originally from cedet-integ-test.el, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 42516a8 254/316: Added cpproot tests, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests c2f09c4 182/316: (cedet-integ-test-proj): Add cit-remove-and-do-shared-lib., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 6945c33 126/316: Expand preprocessor to handle macros which open or close scope., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 558de0d 220/316: Fake emacs.c for project detection purposes., Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests 9e6abad 241/316: Run the code for the compiled binary, Edward John Steere, 2017/01/27
- [Emacs-diffs] scratch/merge-cedet-tests da23314 286/316: Don't fail the test for errors which don't mean a failure, Edward John Steere, 2017/01/27