ut
ut copied to clipboard
Explicit argc/argv passing
This allows user to explicitly specify args for the run.
int main(int argc, const char** argv) {
// explicitly run registered test suites and manually pass argc/argv
return ut::cfg<>.run({.argc = argc, .argv = argv});
}
To get it working yet another event has been added: events::run_begin, which contains argc/argv passed by the user.
TODO
- [ ] update documentation
- [ ] multi-file suites are crashing (args are parsed per compilation unit, but initialized only in main one)
Open questions
- It seems that
detail::cfgis made of two sets of static variables:location+wipused while executing tests (?) and "the rest", which is/should be configurable by user (args). If we extract "the rest" to be non-static (and keep inside static config instance) we could add tests forparsefunction. Would it be OK? - Should implicit argument capturing be default behaviour? I am no fan of it, but I guess both approaches can live next to each other.