C++ test import mapping misses implementations behind included headers

Open
#866 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp
Domain
testing-qa

Research direction

Start with import_based_mapping and the C++ adapter's has_testable_logic, then trace how graph edges such as widget.cpp -> widget.h and behavior_test.cpp -> widget.h are turned into coverage. The reproduction is synthetic and the issue asks for the intended companion-header heuristic before any change, so first confirm the expected mapping with the maintainers. Done means a behavior-named C++ test maps to its implementation file, and the Unreal fix in #865 is not affected.

Written by the indexing model from the issue text.

Description

C++ import-based test mapping recognizes an included header but not its implementation, even when a test invokes an out-of-line function. A test with a behavior-oriented filename also does not get filename-based mapping to the implementation.

Synthetic reproduction (no private source):

// widget.h
int widget();
// widget.cpp
#include "widget.h"
int widget() { return 42; }
// behavior_test.cpp
#include "widget.h"
TEST(Behavior, Result) { EXPECT_EQ(widget(), 42); }

Calling import_based_mapping with graph edges widget.cpp -> widget.h and behavior_test.cpp -> widget.h, production files {widget.cpp, widget.h}, test files {behavior_test.cpp} and language cxx yields {widget.h}. The implementation is absent. The C++ adapter's has_testable_logic treats the declaration header as having logic, so generic facade expansion does not help. This is separate from the Unreal framework recognition fix in #865 and also affects GoogleTest.

A conservative companion-header/implementation mapping hook might help, but blindly reversing every include edge would overclaim coverage for common headers. Please clarify the intended heuristic and extension point. I have not changed coverage inference or scoring weights locally.

Dominant language
Python
Stars
3.8k
Forks
301
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from peteromallet/desloppify

All issues in peteromallet/desloppify

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.