Johnny Chen | 7737777 | 2010-09-07 17:06:13 +0000 | [diff] [blame] | 1 | """ |
| 2 | Test lldb settings command. |
| 3 | """ |
| 4 | |
| 5 | import os, time |
| 6 | import unittest2 |
| 7 | import lldb |
| 8 | from lldbtest import * |
| 9 | |
| 10 | class SettingsCommandTestCase(TestBase): |
| 11 | |
| 12 | mydir = "settings" |
| 13 | |
| 14 | def test_set_prompt(self): |
| 15 | """Test that 'set prompt' actually changes the prompt.""" |
Johnny Chen | 881c371 | 2010-09-07 17:12:10 +0000 | [diff] [blame] | 16 | |
| 17 | # Use '-o' option to override the existing instance setting. |
Johnny Chen | 7737777 | 2010-09-07 17:06:13 +0000 | [diff] [blame] | 18 | self.runCmd("settings set -o prompt 'lldb2'") |
Johnny Chen | 881c371 | 2010-09-07 17:12:10 +0000 | [diff] [blame] | 19 | |
| 20 | # Immediately test the setting. |
Johnny Chen | 7737777 | 2010-09-07 17:06:13 +0000 | [diff] [blame] | 21 | self.expect("settings show prompt", |
| 22 | startstr = "prompt (string) = 'lldb2'") |
Johnny Chen | 881c371 | 2010-09-07 17:12:10 +0000 | [diff] [blame] | 23 | |
| 24 | # The overall display should also reflect the new setting. |
Johnny Chen | 7737777 | 2010-09-07 17:06:13 +0000 | [diff] [blame] | 25 | self.expect("settings show", |
| 26 | substrs = ["prompt (string) = 'lldb2'"]) |
| 27 | |
Johnny Chen | a37764b | 2010-09-07 17:31:05 +0000 | [diff] [blame^] | 28 | 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 Chen | 7737777 | 2010-09-07 17:06:13 +0000 | [diff] [blame] | 42 | |
| 43 | if __name__ == '__main__': |
| 44 | import atexit |
| 45 | lldb.SBDebugger.Initialize() |
| 46 | atexit.register(lambda: lldb.SBDebugger.Terminate()) |
| 47 | unittest2.main() |