[Lldb-commits] [lldb] r148974 - /lldb/trunk/test/functionalities/completion/TestCompletion.py
Johnny Chen
johnny.chen at apple.com
Wed Jan 25 12:50:22 PST 2012
Author: johnny
Date: Wed Jan 25 14:50:21 2012
New Revision: 148974
URL: http://llvm.org/viewvc/llvm-project?rev=148974&view=rev
Log:
Move argument checking/manipulation into the front of the function.
Modified:
lldb/trunk/test/functionalities/completion/TestCompletion.py
Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=148974&r1=148973&r2=148974&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/trunk/test/functionalities/completion/TestCompletion.py Wed Jan 25 14:50:21 2012
@@ -93,6 +93,15 @@
def complete_from_to(self, str_input, patterns):
"""Test that the completion mechanism completes str_input to patterns,
where patterns could be a pattern-string or a list of pattern-strings"""
+ # Patterns should not be None in order to proceed.
+ self.assertFalse(patterns is None)
+ # And should be either a string or list of strings. Check for list type
+ # below, if not, make a list out of the singleton string. If patterns
+ # is not a string or not a list of strings, there'll be runtime errors
+ # later on.
+ if not isinstance(patterns, list):
+ patterns = [patterns]
+
# The default lldb prompt.
prompt = "(lldb) "
@@ -127,10 +136,6 @@
print "\n\nContents of child_read.txt:"
print from_child
- self.assertFalse(patterns is None)
- if type(patterns) is not types.ListType:
- patterns = [patterns]
-
# Test that str_input completes to our patterns.
# If each pattern matches from_child, the completion mechanism works!
for p in patterns:
More information about the lldb-commits
mailing list