]> code.delx.au - gnu-emacs/blobdiff - test/cedet/semantic-ia-utest.el
Update copyright year to 2015
[gnu-emacs] / test / cedet / semantic-ia-utest.el
index e5bc0fb65fdc026095b65f5b249f5e382547ea16..71736c816f70972ac180df6fc5a690c856d6407d 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic-ia-utest.el --- Analyzer unit tests
 
-;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2015 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
 
     "tests/testdoublens.cpp"
     "tests/testsubclass.cpp"
     "tests/testtypedefs.cpp"
-    "tests/teststruct.cpp"
-    "tests/testtemplates.cpp"
     "tests/testfriends.cpp"
-    "tests/testusing.cpp"
     "tests/testnsp.cpp"
     "tests/testsppcomplete.c"
     "tests/testvarnames.c"
@@ -54,7 +51,7 @@
   "List of files with analyzer completion test points.")
 
 (defvar semantic-ia-utest-error-log-list nil
-  "List of errors occuring during a run.")
+  "List of errors occurring during a run.")
 
 ;;;###autoload
 (defun semantic-ia-utest (&optional arg)
@@ -211,7 +208,7 @@ Argument ARG specifies which set of tests to run.
     ))
 
 (defun semantic-ia-utest-buffer-refs ()
-  "Run a analyze-refs unit-test pass in the current buffer."
+  "Run an analyze-refs unit-test pass in the current buffer."
 
   (let* ((idx 1)
         (regex-p nil)
@@ -419,6 +416,27 @@ Argument ARG specifies which set of tests to run.
 
     ))
 
+(defun semantic-symref-test-count-hits-in-tag ()
+  "Lookup in the current tag the symbol under point.
+Then count all the other references to the same symbol within the
+tag that contains point, and return that."
+  (interactive)
+  (let* ((ctxt (semantic-analyze-current-context))
+        (target (car (reverse (oref ctxt prefix))))
+        (tag (semantic-current-tag))
+        (start (current-time))
+        (Lcount 0))
+    (when (semantic-tag-p target)
+      (semantic-symref-hits-in-region
+       target (lambda (start end prefix) (setq Lcount (1+ Lcount)))
+       (semantic-tag-start tag)
+       (semantic-tag-end tag))
+      (when (interactive-p)
+       (message "Found %d occurrences of %s in %.2f seconds"
+                Lcount (semantic-tag-name target)
+                (semantic-elapsed-time start (current-time))))
+      Lcount)))
+
 (defun semantic-src-utest-buffer-refs ()
   "Run a sym-ref counting unit-test pass in the current buffer."
 
@@ -506,4 +524,5 @@ Pass ARGS to format to create the log message."
   (apply 'cedet-utest-log args))
 
 (provide 'semantic-ia-utest)
+
 ;;; semantic-ia-utest.el ends here