Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write line identifying Catch2 test interface in --help output of test builds #4363

Merged
merged 2 commits into from
Jul 19, 2024

Conversation

graydon
Copy link
Contributor

@graydon graydon commented Jun 26, 2024

This adds code to print a single identifying prefix line Catch2 v2.13.10 when you run stellar-core --help on a BUILD_TESTS build.

This, along with a small amount of configuration, is enough to enable vscode and this common C++ testing extension to do automatic unit test discovery and integration with vscode's test system. This gives you:

  • A searchable list of tests in the sidebar
  • One-click access from that list jump to a test, run a test, or (most importantly) run the debugger on a test
  • A little button in the source code at the test header to do the same
  • Log capture and display of each test run and its results

The configuration required in .vscode/settings.json is just the following:

{
    "testMate.cpp.test.advancedExecutables": [
        {
            "pattern": "${workspaceFolder}/src/stellar-core",
            "catch2": {
                "prependTestListingArgs": ["test"],
                "prependTestRunningArgs": ["test"],
                "ignoreTestEnumerationStdErr": true,
                "testGrouping": {
                    "groupBySource": {}
                }
            }
        }
    ]
}

You then get this splendid experience:

image

@SirTyson SirTyson force-pushed the identify-catch2-for-test-discovery branch from ed8db67 to c6b4873 Compare July 8, 2024 17:28
@SirTyson SirTyson self-requested a review July 19, 2024 17:21
@SirTyson SirTyson added this pull request to the merge queue Jul 19, 2024
Merged via the queue into stellar:master with commit c4d7fb1 Jul 19, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants