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    mydir = TestBase.compute_mydir(__file__)
13
14    @expectedFailureAll(
15        compiler="gcc",
16        bugnumber="GCC generates incomplete debug info")
17    @expectedFailureAll(oslist=['windows'], bugnumber="llvm.org/pr26339")
18    @expectedFailureNetBSD
19    def test_with_run_command(self):
20        """Test that auto types work in the expression parser"""
21        self.build()
22        self.runCmd("file " + self.getBuildArtifact("a.out"), CURRENT_EXECUTABLE_SET)
23
24        line = line_number('main.cpp', '// break here')
25        lldbutil.run_break_set_by_file_and_line(
26            self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
27
28        self.runCmd("process launch", RUN_SUCCEEDED)
29
30        self.expect_expr('auto f = 123456; f', result_type='int', result_value='123456')
31        self.expect(
32            'expr struct Test { int x; int y; Test() : x(123), y(456) {} }; auto t = Test(); t',
33            substrs=[
34                'Test',
35                '123',
36                '456'])
37        self.expect(
38            'expr auto s = helloworld; s',
39            substrs=[
40                'string',
41                'hello world'])
42