Re: [racket-users] What does `raco test file.rkt` do by default if no `test` submodule?

2018-09-06 Thread David Storrs
This isn't a direct answer to your question, but you might want to check
out handy/test-more.  Unlike the racket test system it always provides
feedback on what tests have run and it will warn you if you did not run the
expected number of tests.  It also uses shorter names for the tests and
each test returns a useful value so that you can chain tests together or
use them in conditionals.  For example:

;; in test.rkt
#lang racket

(require handy/test-more)

(when (not (equal? 'windows (is (system-type) 'windows "expected to be
running on windows")))
  (void (is (system-type) 'macosx "it's mac"))
  )

(test-suite
 "examples"

 (throws (thunk (raise-arguments-error 'some-func "bad args"))
 #px"bad args"
 "threw as expected")

 (lives (thunk (ok 1 "1 is true"))
"checking truth of 1 did not blow up")
 )



;; at command line (assume you're running on macOS)
$ racket test.rkt

NOT ok 1 - expected to be running on windows
  Got:  'macosx
  Expected: 'windows
ok 2 - it's mac
 (START test-suite:  examples)
ok 3 - threw as expected
ok 4 - 1 is true
ok 5 - checking truth of 1 did not blow up
ok 6 - test-suite completed without throwing uncaught exception

Total tests passed so far: 5
Total tests failed so far: 1
 (END test-suite:  examples)
WARNING: Neither (expect-n-tests N) nor (done-testing) was called.  May not
have run all tests.



There's thorough documentation, although it's in comments instead of in
Scribble so you'll need to actually look in the code.  I keep meaning to
Scribbleify it but haven't found the tuits.  I also have chosen not to have
a handy/main.rkt that would pull in all the pieces of handy, since I feel
like it's better to be explicit about what you want.  If people actually
started using it and asked for that feature then I'd add it.


On Thu, Sep 6, 2018 at 5:46 AM, Marc Kaufmann 
wrote:

> Hi,
>
> I am starting to use raco test for testing, and found out that in a file
> without (module test ...), it may run some kind of test on the file. But
> for some files, raco test reports that it ran a test, for others however no
> test is run.
>
> Right now I am now adding a (module test racket/base) at the end of files
> I have no tests for which leads to 0 tests (as it should). Nonetheless out
> of curiosity, I am wondering why raco reports running a test for
> `pages.rkt`, but not `tools.rkt`, even though both of them are essentially
> defining a bunch of functions and providing them to other files, without
> running any code.
>
> This made me realize that I don't know how to print out which tests were
> run. Is there a way of doing that?
>
> Thanks,
> Marc
>
> --
> 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 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] What does `raco test file.rkt` do by default if no `test` submodule?

2018-09-06 Thread Greg Hendershott
> I am starting to use raco test for testing, and found out that in a file 
> without (module test ...), it may run some kind of test on the file. But for 
> some files, raco test reports that it ran a test, for others however no test 
> is run.
>
> Right now I am now adding a (module test racket/base) at the end of files I 
> have no tests for which leads to 0 tests (as it should). Nonetheless out of 
> curiosity, I am wondering why raco reports running a test for `pages.rkt`, 
> but not `tools.rkt`, even though both of them are essentially defining a 
> bunch of functions and providing them to other files, without running any 
> code.

You can also use -x with raco test: `raco test -x file.rkt`.

Relevant snip from `raco help test`:

/ --run-if-absent, -r : Require module if submodule is absent (on
by default)
\ --no-run-if-absent, -x : Require nothing if submodule is absent

I believe the default is --run-if-absent to support the traditional
approach of putting tests in dedicated files under test/ subdirs.

There are some other interesting flags to check out. You can specify
the submodule name (not just "test"). For example you could have
submodules like `slow-test` or `except-on-ci`, and your makefile or CI
script runs raco test for those submodules (or not) in various
circumstances.

-- 
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.


FW: [racket-users] Semaphore-count

2018-09-06 Thread Jos Koot
Ignore my email on this subject, please.
It is wrong.
Jos

-- 
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.


[racket-users] What does `raco test file.rkt` do by default if no `test` submodule?

2018-09-06 Thread Marc Kaufmann
Hi,

I am starting to use raco test for testing, and found out that in a file 
without (module test ...), it may run some kind of test on the file. But 
for some files, raco test reports that it ran a test, for others however no 
test is run.

Right now I am now adding a (module test racket/base) at the end of files I 
have no tests for which leads to 0 tests (as it should). Nonetheless out of 
curiosity, I am wondering why raco reports running a test for `pages.rkt`, 
but not `tools.rkt`, even though both of them are essentially defining a 
bunch of functions and providing them to other files, without running any 
code.

This made me realize that I don't know how to print out which tests were 
run. Is there a way of doing that?

Thanks,
Marc

-- 
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.