Skip to content

Commit 1a3acc7

Browse files
authored
Merge pull request #26 from m-chaturvedi/add_tests_for_array_etc
Add tests for array, optional and variant
2 parents c400ec6 + 2921f97 commit 1a3acc7

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

cpplint/cpplint.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5376,7 +5376,6 @@ def ExpectingFunctionArgs(clean_lines, linenum):
53765376

53775377

53785378
_HEADERS_CONTAINING_TEMPLATES = (
5379-
('<any>', ('any',)),
53805379
('<array>', ('array',)),
53815380
('<deque>', ('deque',)),
53825381
('<functional>', ('unary_function', 'binary_function',

cpplint/cpplint_unittest.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,39 @@ def testIncludeWhatYouUse(self):
10791079
""",
10801080
'Add #include <utility> for swap'
10811081
' [build/include_what_you_use] [4]')
1082+
self.TestIncludeWhatYouUse(
1083+
"""#include <array>
1084+
std::array<int, 10> A;
1085+
""",
1086+
'')
1087+
self.TestIncludeWhatYouUse(
1088+
"""#include <string>
1089+
std::array<int, 10> A;
1090+
""",
1091+
'Add #include <array> for array<>'
1092+
' [build/include_what_you_use] [4]')
1093+
self.TestIncludeWhatYouUse(
1094+
"""#include <optional>
1095+
std::optional<int> A;
1096+
""",
1097+
'')
1098+
self.TestIncludeWhatYouUse(
1099+
"""#include <string>
1100+
std::optional<int> A;
1101+
""",
1102+
'Add #include <optional> for optional<>'
1103+
' [build/include_what_you_use] [4]')
1104+
self.TestIncludeWhatYouUse(
1105+
"""#include <variant>
1106+
std::variant<int, float> A;
1107+
""",
1108+
'')
1109+
self.TestIncludeWhatYouUse(
1110+
"""#include <string>
1111+
std::variant<int, float> A;
1112+
""",
1113+
'Add #include <variant> for variant<>'
1114+
' [build/include_what_you_use] [4]')
10821115

10831116
# Test the UpdateIncludeState code path.
10841117
mock_header_contents = ['#include "blah/foo.h"', '#include "blah/bar.h"']

0 commit comments

Comments
 (0)