* Testing Functions Internal to a Module
@ 2011-12-17 15:07 Noah Lavine
2011-12-17 15:31 ` Ian Price
0 siblings, 1 reply; 2+ messages in thread
From: Noah Lavine @ 2011-12-17 15:07 UTC (permalink / raw)
To: guile-devel
Hello Guile developers,
I have recently hit an issue and I wish I knew a standard way to handle it.
I want to write tests for a module of mine. Because I like being
paranoid, I'd like to test almost every function in the module. But a
lot of these functions are internal to the module - there's no reason
to export them, except that my test suite needs access to them. So my
choices are to export functions that I don't really want to export, or
to put a bunch of internal module references at the top of my test
program.
Is there a standard way of handling this?
This seems like a place where perhaps a helper procedure would be
useful, because lots of test suites will face this issue. Something
like "import all of this module's private definitions". What does
everyone else do in this situation?
Thanks,
Noah
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Testing Functions Internal to a Module
2011-12-17 15:07 Testing Functions Internal to a Module Noah Lavine
@ 2011-12-17 15:31 ` Ian Price
0 siblings, 0 replies; 2+ messages in thread
From: Ian Price @ 2011-12-17 15:31 UTC (permalink / raw)
To: Noah Lavine; +Cc: guile-devel
Noah Lavine <noah549@gmail.com> writes:
> Is there a standard way of handling this?
>
> This seems like a place where perhaps a helper procedure would be
> useful, because lots of test suites will face this issue. Something
> like "import all of this module's private definitions". What does
> everyone else do in this situation?
When testing at the repl, I've used ,m to great effect, and presumably
you could use set-current-module and co. in a similar way.
Alternatively, you could use (@@ (module name) procedure-name) to access
a private function. Maybe with a helper like
(define-syntax-rule (use-privates module proc-name ...)
(begin (define proc-name (@@ module proc-name)) ...))
--
Ian Price
"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-17 15:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-17 15:07 Testing Functions Internal to a Module Noah Lavine
2011-12-17 15:31 ` Ian Price
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).