Files
graphify/tests/fixtures/sample_doctest.cpp
T
Ousama Ben YounesandClaude Opus 4.8 54b3b78955 fix(cpp): recover doctest/Catch2 string-named TEST_CASE nodes (#2594)
doctest/Catch2 register tests with a string-literal name (TEST_CASE("...")),
which tree-sitter-cpp parses as an ERROR node, so every test function was
silently dropped. Adds a line-anchored regex fallback that appends one code
node per top-level TEST_CASE/TEST_CASE_TEMPLATE/SCENARIO plus a contains edge
from the file node, mirroring the Groovy Spock fallback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-08-15 17:17:29 +01:00

18 lines
313 B
C++

#include <doctest/doctest.h>
static int add(int a, int b) { return a + b; }
TEST_CASE("addition works") {
SUBCASE("small operands") {
CHECK(add(1, 2) == 3);
}
}
TEST_CASE("subtraction works") {
CHECK(add(5, -1) == 4);
}
TEST_CASE("handles \"quoted\" names") {
CHECK(add(0, 0) == 0);
}