-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(aspect): Allow multiple dependencies providing the same header
Such cases shall not cause the DWYU dependency to report an unused dependency.
- Loading branch information
Showing
6 changed files
with
52 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
cc_library( | ||
name = "foo", | ||
hdrs = ["foo.h"], | ||
deps = [ | ||
":bar_a", | ||
":bar_b", | ||
], | ||
) | ||
|
||
cc_library( | ||
name = "bar_a", | ||
hdrs = ["bar.h"], | ||
) | ||
|
||
cc_library( | ||
name = "bar_b", | ||
hdrs = ["bar.h"], | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "multiple_deps_for_one_header/bar.h" |
14 changes: 14 additions & 0 deletions
14
test/aspect/multiple_deps_for_one_header/test_multiple_deps_for_one_header.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from result import ExpectedResult, Result | ||
from test_case import TestCaseBase | ||
|
||
|
||
class TestCase(TestCaseBase): | ||
def execute_test_logic(self) -> Result: | ||
""" | ||
Multiple dependencies providing the same header can be considered an antipattern. Still, with respect to the | ||
DWYU principles it is not wrong. Such cases should not cause a DWYU error. | ||
""" | ||
expected = ExpectedResult(success=True) | ||
actual = self._run_dwyu(target="//multiple_deps_for_one_header:foo", aspect=self.default_aspect) | ||
|
||
return self._check_result(actual=actual, expected=expected) |