abmclin
2017-4-20 15:15:12

To those who are RackUnit experts, I’m asking for some clarification. When I run raco test somefile.rkt, it executes tests and then at the end of its output, it prints something like “7/72 test failures”

I’ve noticed that when I introduce errors on purpose, the denominator number often vary quite a lot which puzzled me at first. Eventually I concluded that the reason for changing denominator number is when a test fails in a test-case form, rest of the tests after the failing test do not run and do not get counted in the total.

So the fraction that gets printed really means how many failing tests out of total number of tests run to date, not how many tests actually written in the source file.

My question is, is there a way to configure raco test to print number of all tests it detects in the source file as opposed to just those that were able to run?

In addition, am I correct in surmising that only forms in the check-* family count as tests?


samth
2017-4-20 15:24:56

@abmclin: to your second question, yes, that’s what “tests” means


samth
2017-4-20 15:25:21

for the first question, no, you can’t do that, because it doesn’t work by “detecting tests in the source file”


samth
2017-4-20 15:25:35

it runs the source file, and each time it runs a test, it adds to the count


samth
2017-4-20 15:25:45

it doesn’t look at the source at all


abmclin
2017-4-20 15:27:48

Ok understood, thank you @samth. I didn’t want to misinterpret the numbers I was seeing. Out of curiosity, raco test doesn’t try to look at the source file before running because it’s impractical to try to detect test cases in advance?


samth
2017-4-20 15:28:19

@abmclin yes, tests could be generated by macros, or created at runtime, for example


samth
2017-4-20 15:28:38

For example, I’ve written tests in Typed Racket that construct a test for each file in a directory


abmclin
2017-4-20 15:29:18

ok got it, yeah that does make it pointless to try to do a static guess of total number of tests.


thinkmoore
2017-4-20 18:04:29

anyone have advice on debugging “desc: identifier’s binding is ambiguous context…: matching binding…: matching binding…: in: desc” in a macro-generating macro?


lexi.lambda
2017-4-20 18:11:25

my solution has mostly been to stare at it very hard until I figure out what’s going on, potentially reducing it to a minimal case that reproduces the problem. so I guess my answer is “no, I don’t have any good debugging advice”.


thinkmoore
2017-4-20 18:12:50

i can’t seem to reproduce in a smaller example either :disappointed:


ben
2017-4-20 18:18:53

thinkmoore
2017-4-20 18:47:07

thanks @lexi.lambda and @ben. debug-scopes gave me just enough info for staring at it to tell me the answer. i was a little surprised though: my macro used defined a name that wasn’t available outside the macro, but was getting reused between macro invocations, causing the issue. replacing that name with a gensym’d generate-temporaries name fixed the problem. i was surprised because this seems less hygienic than I expected.


githree
2017-4-20 19:26:53

What has happened to https://racket.slackarchive.io/ ? I got: “Team by domain "racket” not found." when I try it.


samth
2017-4-20 19:28:58

githree
2017-4-20 19:29:44

OK, thanks