xref: /llvm-project/lldb/test/API/functionalities/alias/TestBtAliasRepeat.py (revision 5e0ee1b395fa6fca9f23f278885c5949277de666)
1import lldb
2from lldbsuite.test.lldbtest import TestBase
3from lldbsuite.test import lldbutil
4
5
6class TestCase(TestBase):
7    def test(self):
8        self.build()
9        lldbutil.run_to_source_breakpoint(self, "return", lldb.SBFileSpec("main.c"))
10
11        # Expect "frame #0" but not "frame #1".
12        self.expect("bt 1", inHistory=True, patterns=["frame #0", "^(?!.*frame #1)"])
13
14        # Run an empty command to run the repeat command for `bt`.
15        # The repeat command for `bt N` lists the subsequent N frames.
16        #
17        # In this case, after printing the frame 0 with `bt 1`, the repeat
18        # command will print "frame #1" (and won't print "frame #0").
19        self.expect("", patterns=["^(?!.*frame #0)", "frame #1"])
20