mirror of
https://github.com/safishamsi/graphify.git
synced 2026-08-29 17:56:41 +00:00
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>
18 lines
313 B
C++
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);
|
|
}
|