Re[1]: Newbie: how to enumerate methods in a class
"Eric M. Ludlam" <[email protected]> Sun, 8 Dec 2002 21:08:35 -0500
| Newsgroups | gmane.emacs.eieio |
|---|---|
| Message-ID | <[email protected]> |
> Thanks I'll look into it. I decided to port Kent Beck's xUnit (Unit
> testing framework) as a project to help me learn more about elisp and
> eieio. I already have a simple port finished, but I'd like to know how to
> enumerate the methods of a class, given the class.
>
> Pseudo code:
>
> testMethods = []
> for method in class:
> if method.asString().beginsWith('test-'):
> testMethods.append(method)
>
That might look like this:
(let ((methods (eieio-all-generic-functions 'yourclasshere)))
(while methods
(if (string-match "^test-" (symbol-string (car methods)))
(funcall (car methods) yourobject other-param))
(setq methods (cdr methods))))
Good Luck. I'll have to try our your new program.
Eric
--
Eric Ludlam: [email protected], [email protected]
Home: http://www.ludlam.net Siege: www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: www.gnu.org
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf