summaryrefslogtreecommitdiff
path: root/test/cedet
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2010-03-29 17:35:39 -0400
committerChong Yidong <cyd@stupidchicken.com>2010-03-29 17:35:39 -0400
commit3cbcd186e13c3c27e3942a448d8cf708cf47c934 (patch)
treeae85671968bff5b8f0b1a7fdcbcac9f3c100097f /test/cedet
parenta4100ebe291e4d2aca4dd8178e7632ba87f7a65e (diff)
downloademacs-3cbcd186e13c3c27e3942a448d8cf708cf47c934.tar.gz
Add a test function from semantic-test.el to semantic-ia-utest.el.
* cedet/semantic-ia-utest.el (semantic-symref-test-count-hits-in-tag): Add function, from semantic-test.el.
Diffstat (limited to 'test/cedet')
-rw-r--r--test/cedet/semantic-ia-utest.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/cedet/semantic-ia-utest.el b/test/cedet/semantic-ia-utest.el
index 92dbaba7615..00f6632f9f3 100644
--- a/test/cedet/semantic-ia-utest.el
+++ b/test/cedet/semantic-ia-utest.el
@@ -416,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."