1"""
2Tests that auto types work
3"""
4import lldb
5from lldbsuite.test.decorators import *
6from lldbsuite.test.lldbtest import *
7from lldbsuite.test import lldbutil
8
9
10class CPPAutoTestCase(TestBase):
11
12    def test_with_run_command(self):
13        """Test that auto types work in the expression parser"""
14        self.build()
15        lldbutil.run_to_source_breakpoint(self, "// break here", lldb.SBFileSpec("main.cpp"))
16
17        self.expect_expr('auto f = 123456; f', result_type='int', result_value='123456')
18        self.expect(
19            'expr struct Test { int x; int y; Test() : x(123), y(456) {} }; auto t = Test(); t',
20            substrs=[
21                'Test',
22                '123',
23                '456'])
24        self.expect_expr("auto s = foo; s", result_type="long", result_value="1234")
25