bolt/deps/llvm-18.1.8/lldb/test/API/lang/cpp/auto/TestCPPAuto.py
2025-02-14 19:21:04 +01:00

23 lines
782 B
Python

"""
Tests that auto types work
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class CPPAutoTestCase(TestBase):
def test_with_run_command(self):
"""Test that auto types work in the expression parser"""
self.build()
lldbutil.run_to_source_breakpoint(
self, "// break here", lldb.SBFileSpec("main.cpp")
)
self.expect_expr("auto f = 123456; f", result_type="int", result_value="123456")
self.expect(
"expr struct Test { int x; int y; Test() : x(123), y(456) {} }; auto t = Test(); t",
substrs=["Test", "123", "456"],
)
self.expect_expr("auto s = foo; s", result_type="long", result_value="1234")