Skip to content

Commit 3372907

Browse files
authored
Ensure test assertions are run for excluded files (#196)
Previously, if a file was excluded, the test's output wouldn't be checked. This uncovered a missing C++ header extension used by the cidentlist tests.
1 parent bfd83b4 commit 3372907

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

.styleguide

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
cppHeaderFileInclude {
22
\.h$
3+
\.hpp$
34
\.inc$
45
}
56

wpiformat/wpiformat/test/tasktest.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ def run(self, output_type):
9292
sys.stdout.seek(0)
9393
output = sys.stdout.read()
9494
sys.stdout = saved_stdout
95+
else:
96+
output = self.inputs[i][1]
97+
success = True
9598

96-
assert output == self.outputs[i][0]
97-
assert success == self.outputs[i][2]
99+
assert output == self.outputs[i][0]
100+
assert success == self.outputs[i][2]

wpiformat/wpiformat/test/test_includeorder.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ def test_includeorder():
536536

537537
# Ensure lines containing #include that aren't includes are not processed
538538
test.add_input("./Test.h", "// #included here" + os.linesep)
539-
test.add_output("// #included here" + os.linesep, False, True)
539+
test.add_latest_input_as_output(True)
540540

541541
# Ensure extra newline isn't inserted between #pragma and #ifdef
542542
test.add_input("./Test.h",

wpiformat/wpiformat/test/test_licenseupdate.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,7 @@ def test_licenseupdate():
173173
"./Excluded.h",
174174
"/* Copyright (c) Company Name 2011-{}. */".format(year) + os.linesep +
175175
os.linesep + file_appendix)
176-
test.add_output(
177-
"/* Copyright (c) Company Name 2011-{}. */".format(year) + os.linesep +
178-
os.linesep + file_appendix, False, True)
176+
test.add_latest_input_as_output(True)
179177

180178
# Ensure license regex matches
181179
test.add_input("./Test.h",

0 commit comments

Comments
 (0)