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
14    @no_debug_info_test
15    def test_quit_exit_code_disallow(self):
16        self.ci.AllowExitCodeOnQuit(False)
17        self.expect(
18            "quit 20",
19            substrs=[
20                "error: The current driver doesn't allow custom exit codes for the quit command"],
21            error=True)
22        self.assertFalse(self.ci.HasCustomQuitExitCode())
23
24    @no_debug_info_test
25    def test_quit_exit_code_allow(self):
26        self.ci.AllowExitCodeOnQuit(True)
27        self.runCmd("quit 10", check=False)
28        self.assertTrue(self.ci.HasCustomQuitExitCode())
29        self.assertEqual(self.ci.GetQuitStatus(), 10)
30