Skip to content

Commit ab8f05c

Browse files
committed
Find output that shouldn't be
1 parent 477c279 commit ab8f05c

1 file changed

Lines changed: 18 additions & 2 deletions

File tree

tools/AttachResults.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def noOutputFixup():
210210

211211
@CmdLine('v')
212212
def viewAttachedFiles():
213-
"""View all files containing output in this directory and below"""
213+
"""Sublime edit all files containing output in this directory and below"""
214214
for java in Path(".").rglob("*.java"):
215215
with java.open() as codefile:
216216
code = codefile.read()
@@ -227,7 +227,7 @@ def viewAttachedFiles():
227227

228228
@CmdLine('s')
229229
def showJavaFiles():
230-
"""Show all java files in this directory and below"""
230+
"""Sublime edit all java files in this directory and below"""
231231
for java in Path(".").rglob("*.java"):
232232
os.system("subl {}".format(java))
233233

@@ -244,6 +244,22 @@ def blankOutputFiles():
244244
if not output.group(1).strip():
245245
print(java)
246246

247+
@CmdLine('u')
248+
def unexpectedOutput():
249+
"""Show java files with output where none was expected"""
250+
os.chdir(str(examplePath))
251+
for java in Path(".").rglob("*.java"):
252+
with java.open() as codeFile:
253+
if "/* Output: (None) */" in codeFile.read():
254+
outfile = java.with_name(java.stem + "-output.txt")
255+
errfile = java.with_name(java.stem + "-erroroutput.txt")
256+
if outfile.exists():
257+
if outfile.stat().st_size:
258+
print("Unexpected output: {}".format(java))
259+
if errfile.exists():
260+
if errfile.stat().st_size:
261+
print("Unexpected error output: {}".format(java))
262+
247263
@CmdLine('a')
248264
def attachFiles():
249265
"""Attach standard and error output to all files"""

0 commit comments

Comments
 (0)