summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2010-10-08 20:01:03 +0000
committerJohnny Chen <johnny.chen@apple.com>2010-10-08 20:01:03 +0000
commitbe7da21d33569d7618d51e73bffaf7c2fa45719e (patch)
tree05744e48db4c393a35012174003b5c486e7a1cb8
parentaf8b4871a83eacc288dfe23bb7ce976027a41977 (diff)
downloadbcm5719-llvm-be7da21d33569d7618d51e73bffaf7c2fa45719e.tar.gz
bcm5719-llvm-be7da21d33569d7618d51e73bffaf7c2fa45719e.zip
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. llvm-svn: 116096
-rw-r--r--lldb/test/settings/TestSettings.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/lldb/test/settings/TestSettings.py b/lldb/test/settings/TestSettings.py
index 51c02595910..b15f7a59927 100644
--- a/lldb/test/settings/TestSettings.py
+++ b/lldb/test/settings/TestSettings.py
@@ -72,10 +72,11 @@ class SettingsCommandTestCase(TestBase):
# 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 @@ class SettingsCommandTestCase(TestBase):
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__':
OpenPOWER on IntegriCloud