blob: d4947274830ed6ea9693ce36e61508171f4dd485 [file] [log] [blame]
Johnny Chen7f5f2802010-08-02 21:26:00 +00001"""
2Test lldb help command.
3
4See also CommandInterpreter::OutputFormattedHelpText().
5"""
Johnny Chen9320d4a2010-06-25 23:15:47 +00006
Johnny Chen8c3f9182010-07-01 00:18:39 +00007import os, time
Johnny Chen9320d4a2010-06-25 23:15:47 +00008import unittest
Johnny Chenbf6ffa32010-07-03 03:41:59 +00009import lldb
10import lldbtest
Johnny Chen9320d4a2010-06-25 23:15:47 +000011
Johnny Chenbf6ffa32010-07-03 03:41:59 +000012class TestHelpCommand(lldbtest.TestBase):
Johnny Chen119b53e2010-07-01 22:52:57 +000013
Johnny Chenbf6ffa32010-07-03 03:41:59 +000014 mydir = "help"
Johnny Chen9320d4a2010-06-25 23:15:47 +000015
16 def test_simplehelp(self):
17 """A simple test of 'help' command and its output."""
18 res = lldb.SBCommandReturnObject()
Johnny Chen7e363f52010-06-28 20:55:57 +000019 self.ci.HandleCommand("help", res)
Johnny Chen8c3f9182010-07-01 00:18:39 +000020 time.sleep(0.1)
Johnny Chen7e363f52010-06-28 20:55:57 +000021 self.assertTrue(res.Succeeded())
22 self.assertTrue(res.GetOutput().startswith(
23 'The following is a list of built-in, permanent debugger commands'))
Johnny Chen7e363f52010-06-28 20:55:57 +000024
25 def test_help_should_not_hang_emacsshell(self):
Johnny Chen94a68992010-06-29 23:17:15 +000026 """Command 'set term-width 0' should not hang the help command."""
Johnny Chen7e363f52010-06-28 20:55:57 +000027 res = lldb.SBCommandReturnObject()
28 self.ci.HandleCommand("set term-width 0", res)
Johnny Chen8c3f9182010-07-01 00:18:39 +000029 time.sleep(0.1)
Johnny Chen7e363f52010-06-28 20:55:57 +000030 self.assertTrue(res.Succeeded())
31 self.ci.HandleCommand("help", res)
Johnny Chen8c3f9182010-07-01 00:18:39 +000032 time.sleep(0.1)
Johnny Chen9320d4a2010-06-25 23:15:47 +000033 self.assertTrue(res.Succeeded())
34 self.assertTrue(res.GetOutput().startswith(
35 'The following is a list of built-in, permanent debugger commands'))
Johnny Chen9320d4a2010-06-25 23:15:47 +000036
37
38if __name__ == '__main__':
Johnny Chen4657be62010-06-29 19:44:16 +000039 lldb.SBDebugger.Initialize()
Johnny Chen9320d4a2010-06-25 23:15:47 +000040 unittest.main()
Johnny Chen4657be62010-06-29 19:44:16 +000041 lldb.SBDebugger.Terminate()