[racket] tests/eli-tester feedback (Was: Racket unit testing)

From: Eli Barzilay (eli at barzilay.org)
Date: Sun Feb 13 19:30:43 EST 2011

Four hours ago, Stefan Schmiedl wrote:
> On Sun, 13 Feb 2011 13:35:48 -0500
> Stephen Bloch <sbloch at adelphi.edu> wrote:
> 
> > How is this an improvement on
> > (test (exact-nonnegative-integer? (fib 10)) => #t
> >          (fib 10) => 55)
> > which doesn't require any special cases at all?
> 
> +1 on that.
> 
> (test
>  (foo) => #t
>  (bar) => 'baz)
> 
> would be very easy to type and quick to read and also force you to
> make explicit if you expect something specific or just anything
> not-#f.

It makes sense to test for non-#f-ness since you might test using more
than plain predicates.  For example:

  (test (member 'x (union '(x y z) '())) => ???)

And even ignoring the argument about `member' vs a `member?', the
bottom line is that the test of "non-#f" is very common -- so I really
don't want to force people to write some verbose

  (test (and E #t) => #t)

or

  (test (not (not E)) => #t)

or even

  (test (true? E) => #t)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.