xref: /llvm-project/lldb/test/API/lang/c/flexible-array-members/TestCFlexibleArrayMembers.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1"""
2Tests C99's flexible array members.
3"""
4
5import lldb
6from lldbsuite.test.decorators import *
7from lldbsuite.test.lldbtest import *
8from lldbsuite.test import lldbutil
9
10
11class TestCase(TestBase):
12    @no_debug_info_test
13    def test(self):
14        self.build()
15        lldbutil.run_to_source_breakpoint(
16            self, "// break here", lldb.SBFileSpec("main.c")
17        )
18
19        self.expect_var_path("c->flexible", type="char[]", summary='"contents"')
20        # self.expect_var_path("sc->flexible", type="signed char[]", summary='"contents"')
21        self.expect_var_path(
22            "uc->flexible", type="unsigned char[]", summary='"contents"'
23        )
24        # TODO: Make this work
25        self.expect("expr c->flexible", error=True, substrs=["incomplete", "char[]"])
26        self.expect(
27            "expr sc->flexible", error=True, substrs=["incomplete", "signed char[]"]
28        )
29        self.expect(
30            "expr uc->flexible", error=True, substrs=["incomplete", "unsigned char[]"]
31        )
32