[plt-scheme] Question about the test suite and modules
I've just checked in a change to DrScheme that helps with part of this
problem (inspired by your previous post, but I just hadn't had time to
find it and respond to it yet; apologies).
If you set the language to `module', then the test suite cases now
behave just like the interactions window in DrScheme; that is, the
expressions are evaluated as if they are inside the module's body. You
will need the latest exp-tagged CVS sources for this change (see
http://www.plt-scheme.org/anoncvs/ for details on using our CVS
version).
As far as the other question goes, we do plan to add different kind of
test case entries, including tests for errors and sections that just
contain definitions of helper functions for the test suite (which could
also be used for such pre-/post- processing).
Robby
At Fri, 3 Jan 2003 17:57:15 -0500, "John W. Small" wrote:
> ------------------------------------------------------------------------------
> Can the test suite test modules?
>
> I wanted to use it to test modules. Suppose I have the following
> module foo
>
> (module foo mzscheme
> (provide (all-defined))
> (define (double x) (* 2 x)))
>
>
> and want to test it with
>
> call: (double 2)
> expected: 4
>
> It looks like I need to create an intermediate program
>
> (require (file "./foo.scm"))
>
> and make the test cases against this testable program (versus
> a module). Since require must be at the top level I can't just
> write the call as
>
> (begin
> (require foo) ; error - not at top level
> (double 2))
>
> Is there an easier way to write a test suite for foo and modules
> in general?
>
> Would it make sense to add pre and post processing to
> the test suite? In other words the (require foo) could
> be included the pre processing. The pre and post processing
> could be used to set up test jigs or structures that are used in
> a multitude of the test cases.
>
> Thanks!
>
> John
>
>
>
> ------------------------------------------------------------------------------
> Can the test suite test modules?
>
>
> I wanted to use it to test modules. Suppose I have the following
> module foo
>
> (module foo mzscheme
> (provide (all-defined))
> (define (double x) (* 2 x)))
>
>
> and want to test it with
>
> call: (double 2)
> expected: 4
>
> It looks like I need to create an intermediate program
>
> (require (file "./foo.scm"))
>
> and make the test cases against this testable program (versus
> a module). Since require must be at the top level I can't just
> write the call as
>
> (begin
> (require foo) ; error - not at top level
> (double 2))
>
> Is there an easier way to write a test suite for foo and modules
> in general?
>
> Would it make sense to add pre and post processing to
> the test suite? In other words the (require foo) could
> be included the pre processing. The pre and post processing
> could be used to set up test jigs or structures that are used in
> a multitude of the test cases.
>
> Thanks!
>
> John
>
>
>