catchorg / catchorg/Catch2

Bake command line option into source?

Open
#1,071 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

Is there a way to bake a command line option like --break or --use-colour yes into my source (without modifying catch.hpp)? If I'm right that there's no way to do this, consider this a feature request.

I'm using Visual Studio 2017 with a CMake project. (In case you aren't familiar with it, it's something new to 2017 called Open Folder, where it runs CMake natively and does NOT translate to VS solutions/projects/etc.) The only way that I'm aware of to give a command line argument to one of my unit test programs is to edit a json file (launch.vs.json), list the program and its command line arguments. The file does have an empty "defaults" section, but adding "args": [ "--break" ] to it doesn't work as I was hoping, so I'm not sure they've implemented the defaults yet.

This leads to having to list every unit test program and repetitively add the arguments to each, and maintain the json file as new unit test programs are added.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.