Add a test sequence for test_expr_commands_can_handle_quotes(self):

# runCmd: command alias print_hi expression printf ("\n\tHi!")
        # output: 
        self.runCmd('command alias print_hi expression printf ("\\n\\tHi!")')
        # This fails currently.
        self.runCmd('print_hi')

and modify existing test sequences to escape the escape character '\ to prevent it
from being interpreted by Python before passing on to the lldb command interpreter.

llvm-svn: 121183
This commit is contained in:
Johnny Chen 2010-12-07 20:52:36 +00:00
parent cf096a431a
commit 74481444ab
1 changed files with 24 additions and 3 deletions

View File

@ -85,10 +85,31 @@ class BasicExprCommandsTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
# runCmd: expression 'a'
# output: (char) $0 = 'a'
self.runCmd("expression 'a'")
self.runCmd('expression printf("\t\x68\n")')
self.runCmd('expression printf("\"\n")')
self.runCmd('expression printf("\'\n")')
# runCmd: expression printf ("\n\n\tHello there!")
# output: (unsigned long) $1 = 15
self.runCmd('expression printf ("\\n\\n\\tHello there!")')
# runCmd: expression printf("\t\x68\n")
# output: (unsigned long) $2 = 3
self.runCmd('expression printf("\\t\\x68\\n")')
# runCmd: expression printf("\"\n")
# output: (unsigned long) $3 = 2
self.runCmd('expression printf("\\"\\n")')
# runCmd: expression printf("'\n")
# output: (unsigned long) $4 = 2
self.runCmd('expression printf("\'\\n")')
# runCmd: command alias print_hi expression printf ("\n\tHi!")
# output:
self.runCmd('command alias print_hi expression printf ("\\n\\tHi!")')
# This fails currently.
self.runCmd('print_hi')
if __name__ == '__main__':