[Lldb-commits] [lldb] r116115 - in /lldb/trunk/test: breakpoint_command/TestBreakpointCommand.py settings/TestSettings.py

Johnny Chen johnny.chen at apple.com
Fri Oct 8 15:10:42 PDT 2010


Author: johnny
Date: Fri Oct  8 17:10:42 2010
New Revision: 116115

URL: http://llvm.org/viewvc/llvm-project?rev=116115&view=rev
Log:
Wrap the rest of file reading operations inside a with block and convert a assertTrue()
usage to self.expect() which is more descriptive.

Modified:
    lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py
    lldb/trunk/test/settings/TestSettings.py

Modified: lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py?rev=116115&r1=116114&r2=116115&view=diff
==============================================================================
--- lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py (original)
+++ lldb/trunk/test/breakpoint_command/TestBreakpointCommand.py Fri Oct  8 17:10:42 2010
@@ -65,10 +65,11 @@
         # Check that the file 'output.txt' exists and contains the string "lldb".
 
         # Read the output file produced by running the program.
-        output = open('output.txt', 'r').read()
+        with open('output.txt', 'r') as f:
+            output = f.read()
 
-        self.assertTrue(output.startswith("lldb"),
-                        "File 'output.txt' and the content matches")
+        self.expect(output, "File 'output.txt' and the content matches", exe=False,
+            startstr = "lldb")
 
         # Finish the program.
         self.runCmd("process continue")

Modified: lldb/trunk/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=116115&r1=116114&r2=116115&view=diff
==============================================================================
--- lldb/trunk/test/settings/TestSettings.py (original)
+++ lldb/trunk/test/settings/TestSettings.py Fri Oct  8 17:10:42 2010
@@ -70,7 +70,8 @@
         self.runCmd("run", RUN_SUCCEEDED)
 
         # Read the output file produced by running the program.
-        output = open('output.txt', 'r').read()
+        with open('output.txt', 'r') as f:
+            output = f.read()
 
         self.expect(output, exe=False,
             substrs = ["argv[1] matches",





More information about the lldb-commits mailing list