1import lldb
2from lldbsuite.test.lldbtest import *
3import lldbsuite.test.lldbutil as lldbutil
4
5
6class TestCase(TestBase):
7    def test_raw_bytes(self):
8        self.build()
9        lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.c"))
10        self.runCmd("type summary add -s '${var.ubyte:x-2}${var.sbyte:x-2}!' Bytes")
11        self.expect("v bytes", substrs=[" = 3001!"])
12
13    def test_bad_format(self):
14        self.build()
15        lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.c"))
16        self.expect(
17            "type summary add -s '${var.ubyte:y}!' Bytes",
18            error=True,
19            substrs=["invalid llvm format"],
20        )
21