emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r99698: Add a test function from s


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r99698: Add a test function from semantic-test.el to semantic-ia-utest.el.
Date: Mon, 29 Mar 2010 17:35:39 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99698
committer: Chong Yidong <address@hidden>
branch nick: emacs-23
timestamp: Mon 2010-03-29 17:35:39 -0400
message:
  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.
modified:
  test/ChangeLog
  test/cedet/semantic-ia-utest.el
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2010-03-29 21:26:49 +0000
+++ b/test/ChangeLog    2010-03-29 21:35:39 +0000
@@ -1,5 +1,9 @@
 2010-03-29  Chong Yidong  <address@hidden>
 
+       * cedet/semantic-ia-utest.el
+       (semantic-symref-test-count-hits-in-tag): Add function, from
+       semantic-test.el.
+
        * cedet/tests/test.cpp:
        * cedet/tests/test.py:
        * cedet/tests/teststruct.cpp:

=== modified file 'test/cedet/semantic-ia-utest.el'
--- a/test/cedet/semantic-ia-utest.el   2010-03-29 21:26:49 +0000
+++ b/test/cedet/semantic-ia-utest.el   2010-03-29 21:35:39 +0000
@@ -416,6 +416,27 @@
 
     ))
 
+(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."
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]