From ab8f05c8eb824158ffcfc51bee8d87bfcb9a50f3 Mon Sep 17 00:00:00 2001 From: Bruce Eckel Date: Tue, 9 Jun 2015 11:43:40 -0700 Subject: [PATCH] Find output that shouldn't be --- tools/AttachResults.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/AttachResults.py b/tools/AttachResults.py index 4e7aabdf..55ecd17a 100644 --- a/tools/AttachResults.py +++ b/tools/AttachResults.py @@ -210,7 +210,7 @@ def noOutputFixup(): @CmdLine('v') def viewAttachedFiles(): - """View all files containing output in this directory and below""" + """Sublime edit all files containing output in this directory and below""" for java in Path(".").rglob("*.java"): with java.open() as codefile: code = codefile.read() @@ -227,7 +227,7 @@ def viewAttachedFiles(): @CmdLine('s') def showJavaFiles(): - """Show all java files in this directory and below""" + """Sublime edit all java files in this directory and below""" for java in Path(".").rglob("*.java"): os.system("subl {}".format(java)) @@ -244,6 +244,22 @@ def blankOutputFiles(): if not output.group(1).strip(): print(java) +@CmdLine('u') +def unexpectedOutput(): + """Show java files with output where none was expected""" + os.chdir(str(examplePath)) + for java in Path(".").rglob("*.java"): + with java.open() as codeFile: + if "/* Output: (None) */" in codeFile.read(): + outfile = java.with_name(java.stem + "-output.txt") + errfile = java.with_name(java.stem + "-erroroutput.txt") + if outfile.exists(): + if outfile.stat().st_size: + print("Unexpected output: {}".format(java)) + if errfile.exists(): + if errfile.stat().st_size: + print("Unexpected error output: {}".format(java)) + @CmdLine('a') def attachFiles(): """Attach standard and error output to all files"""