The problem is that a test-case expression runs a test immediately; it does
not return a test object to be run later. In your case, the test runs while
my-test-case is being defined, then no test at all actually runs
(my-test-case is just #<void>).
A test-suite expression, however, *does* construct a test for running
later. You probably want something more like this:
"My Test case"
(check eq? 1 1))))
Note that test-suites can be nested inside of other test-suites, so you can
get modularity back that way if desired.
On Sat, Feb 25, 2017 at 1:17 AM, Alex Harsanyi <alexharsa...@gmail.com>
> I'm a bit confused about how raco test is reporting the number of tests
> run, if a test case is defined outside a test suite. If I run the program
> #lang racket
> (require rackunit)
> (require rackunit/text-ui)
> (define my-test-case
> "My Test case"
> (check eq? 1 1)))
> (define my-test-suite
> "My test-suite"
> (module+ test
> (run-tests my-test-suite))
> I get:
> $ raco test test/t.rkt
> raco test: (submod "test/t.rkt" test)
> 0 success(es) 0 failure(s) 0 error(s) 0 test(s) run
> 1 test passed
> the test is clearly run (I even put a printf inside my-test-case to be
> convinced of that), yet the first output line indicates that there were 0
> successes and 0 tests run. The last output line seems to be consistent
> with the number of tests (checks) run.
> How do I structure my test programs, such that raco test displays the
> actual number of tests run?
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.