[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/merge-cedet-tests 05006be 049/316: Semantic Symref
From: |
Edward John Steere |
Subject: |
[Emacs-diffs] scratch/merge-cedet-tests 05006be 049/316: Semantic Symref testing. |
Date: |
Sat, 28 Jan 2017 09:09:45 +0000 (UTC) |
branch: scratch/merge-cedet-tests
commit 05006be0d97dce3bc47952d7b88de596bb6b324f
Author: zappo <address@hidden>
Commit: Edward John Steere <address@hidden>
Semantic Symref testing.
---
test/manual/cedet/cit-symref.el | 99 +++++++++++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
diff --git a/test/manual/cedet/cit-symref.el b/test/manual/cedet/cit-symref.el
new file mode 100644
index 0000000..e24ae48
--- /dev/null
+++ b/test/manual/cedet/cit-symref.el
@@ -0,0 +1,99 @@
+;;; cit-symref.el ---
+;;
+;; Copyright (C) 2010 Eric M. Ludlam
+;;
+;; Author: Eric M. Ludlam <address@hidden>
+;; X-RCS: $Id: cit-symref.el,v 1.1 2010-04-18 00:33:36 zappo Exp $
+;;
+;; 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:
+;;
+;; Test the Symref refactoring tool against this made up project.
+;;
+;; We can't test much in symref in the utest setup because they can't
+;; do the refactoring steps, so we have to do them here instead.
+
+;;; Code:
+
+
+(defun cit-symref ()
+ "Test the symref tool."
+ ;; Start in a C++ file.
+ (find-file (cit-file "src/main.cpp"))
+
+ (let* ((target (car cit-symref-operations))
+ (dest (car (cdr cit-symref-operations)))
+ )
+ ;; 7 - Run the symref tool
+ ;; Create the UI
+ (semantic-symref-symbol target)
+ (cit-symref-count '(2 3 0 0))
+
+ ;; expand them all
+ (semantic-symref-list-expand-all)
+ (cit-symref-count '(2 3 4 0))
+
+ ;; Perform a rename.
+ (semantic-symref-list-rename-open-hits dest)
+ (save-some-buffers t)
+ (cit-symref-count '(2 3 4 0))
+
+ ;; Create a new symref buffer!
+ (find-file (cit-file "src/main.cpp"))
+ (semantic-symref-symbol dest)
+ (cit-symref-count '(2 3 0 0))
+
+ ;; Compile and run the refactored code.
+ (find-file (cit-file "src/main.cpp"))
+ (cit-compile-and-wait)
+ (find-file (cit-file "src/main.cpp"))
+ (cit-run-target "./Prog")
+ ))
+
+(defun cit-symref-count (expected)
+ "Count the current results, and return a list of the results.
+Argument EXPECTED is the expected result count."
+ (save-excursion
+ (goto-char (point-min))
+ (sit-for 0)
+ (let ((files 0)
+ (hits 0)
+ (res 0)
+ (other 0))
+ (while (not (eobp))
+ (beginning-of-line)
+ (cond ((looking-at "[^ ]")
+ (setq files (1+ files)))
+ ((looking-at " \\[")
+ (setq hits (1+ hits)))
+ ((looking-at " ")
+ (setq res (1+ res)))
+ (t (setq other (1+ other))))
+ (forward-line 1)
+ (end-of-line))
+ (unless (and (= files (nth 0 expected))
+ (= hits (nth 1 expected))
+ (= res (nth 2 expected))
+ (= other (nth 3 expected)))
+ (error "Symref Missmatch: %S != %S"
+ (list files hits res other)
+ expected)))))
+
+
+(provide 'cit-symref)
+
+;;; cit-symref.el ends here
- [Emacs-diffs] scratch/merge-cedet-tests 6945c33 126/316: Expand preprocessor to handle macros which open or close scope., (continued)
- [Emacs-diffs] scratch/merge-cedet-tests 6945c33 126/316: Expand preprocessor to handle macros which open or close scope., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 89526ab 134/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 0e41dab 116/316: Move tests in cedet/semantic, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 8ba639f 150/316: (ede-detect-utest-project-list): Add jvm-base projects for ant, lein, maven, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 284144e 154/316: Fixes for test execution, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests fa54ec1 162/316: (isFooLike, A, B, main2): New test tweaked from example by Liang Wang, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests cebc72c 228/316: Make unit tests use randomized file names, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 7fce11d 056/316: Uniquafy names from last example from Martin to include ms_ prefix., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 779f839 032/316: (LOADPATH): Add speedbar. (EMACSFLAGS): New variable (Lisp): Use above., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 1c4ec31 045/316: Add test for parsing local variables, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 05006be 049/316: Semantic Symref testing.,
Edward John Steere <=
- [Emacs-diffs] scratch/merge-cedet-tests c2fada4 230/316: Force srecode repo location and add decorations to debug output, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests f916b8f 125/316: C/C++: Fix function pointer parsing, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests c40401d 273/316: Remove obsolete cvs-auto-updated 'X-RCS' line., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 19646a7 141/316: semantic/bovine/c: Add support for typedef references, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 5ef7a99 157/316: tests: Fix typo in ede/detect-utest, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 14c75f7 175/316: (cit-version): New variable. (semantic): New require, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 0781aac 164/316: Add comments, require cedet-files., Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 47b5933 185/316: Move compilation error handling to new function, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 2c1d730 190/316: Ignore Members On Extra Tags, Edward John Steere, 2017/01/28
- [Emacs-diffs] scratch/merge-cedet-tests 7661178 186/316: Improve compilation error checking, Edward John Steere, 2017/01/28