blob: 10cfedc720ed6c1a6ccc1a18bfd7ce7665b6a67f [file] [log] [blame]
Johnny Chen77377772010-09-07 17:06:13 +00001"""
2Test lldb settings command.
3"""
4
5import os, time
6import unittest2
7import lldb
8from lldbtest import *
9
10class SettingsCommandTestCase(TestBase):
11
12 mydir = "settings"
13
14 def test_set_prompt(self):
15 """Test that 'set prompt' actually changes the prompt."""
Johnny Chen881c3712010-09-07 17:12:10 +000016
17 # Use '-o' option to override the existing instance setting.
Johnny Chen77377772010-09-07 17:06:13 +000018 self.runCmd("settings set -o prompt 'lldb2'")
Johnny Chen881c3712010-09-07 17:12:10 +000019
20 # Immediately test the setting.
Johnny Chen77377772010-09-07 17:06:13 +000021 self.expect("settings show prompt",
22 startstr = "prompt (string) = 'lldb2'")
Johnny Chen881c3712010-09-07 17:12:10 +000023
24 # The overall display should also reflect the new setting.
Johnny Chen77377772010-09-07 17:06:13 +000025 self.expect("settings show",
26 substrs = ["prompt (string) = 'lldb2'"])
27
Johnny Chena37764b2010-09-07 17:31:05 +000028 def test_set_term_width(self):
29 """Test that 'set term-width' actually changes the term-width."""
30
31 # No '-o' option is needed for static setting.
32 self.runCmd("settings set term-width 70")
33
34 # Immediately test the setting.
35 self.expect("settings show term-width",
36 startstr = "term-width (int) = '70'")
37
38 # The overall display should also reflect the new setting.
39 self.expect("settings show",
40 startstr = "term-width (int) = 70")
41
Johnny Chen77377772010-09-07 17:06:13 +000042
43if __name__ == '__main__':
44 import atexit
45 lldb.SBDebugger.Initialize()
46 atexit.register(lambda: lldb.SBDebugger.Terminate())
47 unittest2.main()