[Lldb-commits] [lldb] r116096 - /lldb/trunk/test/settings/TestSettings.py
Johnny Chen
johnny.chen at apple.com
Fri Oct 8 13:01:03 PDT 2010
Author: johnny
Date: Fri Oct 8 15:01:03 2010
New Revision: 116096
URL: http://llvm.org/viewvc/llvm-project?rev=116096&view=rev
Log:
Convert two instances of assertTrue() and string matching usages to self.expect()
which is more descriptive. And wrap the file open operation inside a with block
so that close() is automatically called upon exiting the block.
Modified:
lldb/trunk/test/settings/TestSettings.py
Modified: lldb/trunk/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=116096&r1=116095&r2=116096&view=diff
==============================================================================
--- lldb/trunk/test/settings/TestSettings.py (original)
+++ lldb/trunk/test/settings/TestSettings.py Fri Oct 8 15:01:03 2010
@@ -72,10 +72,11 @@
# Read the output file produced by running the program.
output = open('output.txt', 'r').read()
- self.assertTrue(output.startswith("argv[1] matches") and
- output.find("argv[2] matches") > 0 and
- output.find("argv[3] matches") > 0 and
- output.find("Environment variable 'MY_ENV_VAR' successfully passed.") > 0)
+ self.expect(output, exe=False,
+ substrs = ["argv[1] matches",
+ "argv[2] matches",
+ "argv[3] matches",
+ "Environment variable 'MY_ENV_VAR' successfully passed."])
@unittest2.expectedFailure
# rdar://problem/8435794
@@ -95,10 +96,11 @@
self.runCmd("run", RUN_SUCCEEDED)
# Read the output file produced by running the program.
- output = open('stdout.txt', 'r').read()
+ with open('stdout.txt', 'r') as f:
+ output = f.read()
- self.assertTrue(
- output.startswith("This message should go to standard out."))
+ self.expect(output, exe=False,
+ startstr = "This message should go to standard out.")
if __name__ == '__main__':
More information about the lldb-commits
mailing list