diff options
| author | Chong Yidong | 2010-03-29 17:35:39 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-03-29 17:35:39 -0400 |
| commit | 3cbcd186e13c3c27e3942a448d8cf708cf47c934 (patch) | |
| tree | ae85671968bff5b8f0b1a7fdcbcac9f3c100097f | |
| parent | a4100ebe291e4d2aca4dd8178e7632ba87f7a65e (diff) | |
| download | emacs-3cbcd186e13c3c27e3942a448d8cf708cf47c934.tar.gz emacs-3cbcd186e13c3c27e3942a448d8cf708cf47c934.zip | |
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.
| -rw-r--r-- | test/ChangeLog | 4 | ||||
| -rw-r--r-- | test/cedet/semantic-ia-utest.el | 21 |
2 files changed, 25 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 3ed59893802..da85fc4a1bf 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2010-03-29 Chong Yidong <cyd@stupidchicken.com> | 1 | 2010-03-29 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 2 | ||
| 3 | * cedet/semantic-ia-utest.el | ||
| 4 | (semantic-symref-test-count-hits-in-tag): Add function, from | ||
| 5 | semantic-test.el. | ||
| 6 | |||
| 3 | * cedet/tests/test.cpp: | 7 | * cedet/tests/test.cpp: |
| 4 | * cedet/tests/test.py: | 8 | * cedet/tests/test.py: |
| 5 | * cedet/tests/teststruct.cpp: | 9 | * cedet/tests/teststruct.cpp: |
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. | |||
| 416 | 416 | ||
| 417 | )) | 417 | )) |
| 418 | 418 | ||
| 419 | (defun semantic-symref-test-count-hits-in-tag () | ||
| 420 | "Lookup in the current tag the symbol under point. | ||
| 421 | Then count all the other references to the same symbol within the | ||
| 422 | tag that contains point, and return that." | ||
| 423 | (interactive) | ||
| 424 | (let* ((ctxt (semantic-analyze-current-context)) | ||
| 425 | (target (car (reverse (oref ctxt prefix)))) | ||
| 426 | (tag (semantic-current-tag)) | ||
| 427 | (start (current-time)) | ||
| 428 | (Lcount 0)) | ||
| 429 | (when (semantic-tag-p target) | ||
| 430 | (semantic-symref-hits-in-region | ||
| 431 | target (lambda (start end prefix) (setq Lcount (1+ Lcount))) | ||
| 432 | (semantic-tag-start tag) | ||
| 433 | (semantic-tag-end tag)) | ||
| 434 | (when (interactive-p) | ||
| 435 | (message "Found %d occurrences of %s in %.2f seconds" | ||
| 436 | Lcount (semantic-tag-name target) | ||
| 437 | (semantic-elapsed-time start (current-time)))) | ||
| 438 | Lcount))) | ||
| 439 | |||
| 419 | (defun semantic-src-utest-buffer-refs () | 440 | (defun semantic-src-utest-buffer-refs () |
| 420 | "Run a sym-ref counting unit-test pass in the current buffer." | 441 | "Run a sym-ref counting unit-test pass in the current buffer." |
| 421 | 442 | ||