Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/Progmasoft/Catch3/TestSpec.cpp
diff options
context:
space:
mode:
authorLeitwolf112026-10-29 19:22:21 +0300
committerLeitwolf112026-10-29 19:22:21 +0300
commitf41a9c3c01b4df1100e24a63987716cb4dbf28f2 (patch)
tree8e5355fcdcfb0bcd3371006ce11dc2f16e6dfd58 /src/Progmasoft/Catch3/TestSpec.cpp
parent1d48419b7ef642917ebf7dfd16c3bc1b3050d8f1 (diff)
downloadcatch3-f41a9c3c01b4df1100e24a63987716cb4dbf28f2.tar.gz
Read the options of a project from catch3.json
A project can now keep the options it always wants in a catch3.json instead of repeating them in every CTest, Bazel or CI command line. Where it is found: the runner looks in the working directory and in each directory above it, up to the root of the Git repository that holds the working directory, and reads the nearest file. Outside a repository it looks only in the working directory, so a stray file in a home directory never applies. --config=FILE names a file instead (relative to the working directory) and --no-config reads none; the last of the two wins. Workers, --help and --version read no file, so a broken file never stands in the way of help, and workers keep taking everything from their runner. What it says: strict JSON with "version": 1 required and "$schema" allowed for editors. The keys are the long options of the command line, and each value becomes the arguments it stands for and goes through the same parser, so there is one set of checks and one set of messages; the file and the key are named in front of them. Values are typed: switches take true (false for the negated adaptive-timeout and bisect), counts take whole numbers, timeout and the confidence interval take numbers, retries and seed take a number or a word, tests and warn take arrays, verbosity takes quiet, normal or verbose, and history takes a path or false. Paths are relative to the directory of the file. An unknown key is an error with a suggestion when it is close to a known one; a key that names an option for one run (shard, section, list, replay, ...) is told that it belongs on the command line. Repeated keys are refused. Precedence: the file's options are applied first and the command line on top, so the command line wins; test specs on the command line replace the file's tests instead of widening them with "or". --verbose names the file that was read. Options gains --config and --no-config, a ParseOptions overload that starts from given options, and a public EditDistance for the suggestions. The new ProjectConfig module holds the search, the key table and ParseCommandLine, which Runner now calls in place of ParseOptions. Tests cover the search (nearest file, the repository boundary, outside a repository), every key, words and defaults, relative and absolute paths, the messages for wrong files, precedence, --config, --no-config and the modes that read no file. A fuzzer reads arbitrary file text and checks that the worker arguments of the result parse again. The command line reference, the runner guide and the release notes describe the file; the amalgamated sources are regenerated.
Diffstat (limited to 'src/Progmasoft/Catch3/TestSpec.cpp')
0 files changed, 0 insertions, 0 deletions