xref: /llvm-project/lldb/test/API/commands/quit/TestQuit.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1"""
2Test lldb's quit command.
3"""
4
5
6import lldb
7from lldbsuite.test.decorators import *
8from lldbsuite.test.lldbtest import *
9from lldbsuite.test import lldbutil
10
11
12class QuitCommandTestCase(TestBase):
13    @no_debug_info_test
14    def test_quit_exit_code_disallow(self):
15        self.ci.AllowExitCodeOnQuit(False)
16        self.expect(
17            "quit 20",
18            substrs=[
19                "error: The current driver doesn't allow custom exit codes for the quit command"
20            ],
21            error=True,
22        )
23        self.assertFalse(self.ci.HasCustomQuitExitCode())
24
25    @no_debug_info_test
26    def test_quit_exit_code_allow(self):
27        self.ci.AllowExitCodeOnQuit(True)
28        self.runCmd("quit 10", check=False)
29        self.assertTrue(self.ci.HasCustomQuitExitCode())
30        self.assertEqual(self.ci.GetQuitStatus(), 10)
31