xref: /llvm-project/lldb/test/API/commands/command/invalid-args/TestInvalidArgsCommand.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1import lldb
2from lldbsuite.test.lldbtest import *
3from lldbsuite.test.decorators import *
4
5
6class InvalidArgsCommandTestCase(TestBase):
7    @no_debug_info_test
8    def test_script_add(self):
9        self.expect(
10            "command script add 1 2",
11            error=True,
12            substrs=["Path component: '1' not found"],
13        )
14
15        self.expect(
16            "command script add",
17            error=True,
18            substrs=["'command script add' requires at least one argument"],
19        )
20
21    @no_debug_info_test
22    def test_script_clear(self):
23        self.expect(
24            "command script clear f",
25            error=True,
26            substrs=["'command script clear' doesn't take any arguments"],
27        )
28
29    @no_debug_info_test
30    def test_script_list(self):
31        self.expect(
32            "command script list f",
33            error=True,
34            substrs=["'command script list' doesn't take any arguments"],
35        )
36
37    @no_debug_info_test
38    def test_script_import(self):
39        self.expect(
40            "command script import",
41            error=True,
42            substrs=["command script import needs one or more arguments"],
43        )
44
45    @no_debug_info_test
46    def test_alias(self):
47        self.expect(
48            "command alias",
49            error=True,
50            substrs=["'command alias' requires at least two arguments"],
51        )
52
53        self.expect(
54            "command alias blub foo",
55            error=True,
56            substrs=[
57                "error: invalid command given to 'command alias'. 'foo' does not begin with a valid command.  No alias created."
58            ],
59        )
60
61    @no_debug_info_test
62    def test_unalias(self):
63        self.expect(
64            "command unalias",
65            error=True,
66            substrs=["must call 'unalias' with a valid alias"],
67        )
68
69    @no_debug_info_test
70    def test_delete(self):
71        self.expect(
72            "command delete",
73            error=True,
74            substrs=["must call 'command delete' with one or more valid user"],
75        )
76
77    @no_debug_info_test
78    def test_regex(self):
79        self.expect(
80            "command regex",
81            error=True,
82            substrs=["usage: 'command regex <command-name> "],
83        )
84
85    @no_debug_info_test
86    def test_source(self):
87        self.expect(
88            "command source",
89            error=True,
90            substrs=[
91                "'command source' takes exactly one executable filename argument."
92            ],
93        )
94