Using the shebang trick of the FAQ, I would rather write the script in Julia, simply making the required adjustments for it to be runnable from the command-line:
#!/bin/bash
#=
exec julia --color=yes --startup-file=no "${BASH_SOURCE[0]}" "$@"
=#
using Pkg
Pkg.activate(@__DIR__)
Pkg.test()
If you want to stick to a pure shell script, then something along those lines should work:
#!/bin/bash
exec julia --color=yes --startup-file=no -e "
using Pkg
Pkg.activate(@__DIR__)
Pkg.test()
"
Why would you like to manage dependencies in such a script? The (possibly test-only) dependencies of your project should be stored in the *.toml files acompanying your project; there would normally be no need to add them each time you want to run tests.
I’m dealing with a project involving about a hundred functions and many hundreds of test cases, each implemented as functions too. I already have a script to generate the HTML documentation for the whole project, so I am looking for a similar canned solution to generate all tests using a simple shell script, which can run independently from any other activity going on. It’s essentially a matter of convenience…
Yes, indeed, the Test package is mentioned in the [deps] of the Project.toml file in the test subdirectory… Thanks for clarifying this point.