]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - packages/Python/lldbsuite/test/expression_command/call-function/TestCallStdStringFunction.py
Vendor import of lldb release_39 branch r276489:
[FreeBSD/FreeBSD.git] / packages / Python / lldbsuite / test / expression_command / call-function / TestCallStdStringFunction.py
1 """
2 Test calling std::String member functions.
3 """
4
5 from __future__ import print_function
6
7
8
9 import lldb
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
13
14 class ExprCommandCallFunctionTestCase(TestBase):
15
16     mydir = TestBase.compute_mydir(__file__)
17
18     def setUp(self):
19         # Call super's setUp().
20         TestBase.setUp(self)
21         # Find the line number to break for main.c.
22         self.line = line_number('main.cpp',
23                                 '// Please test these expressions while stopped at this line:')
24
25     @expectedFailureAll(compiler="icc", bugnumber="llvm.org/pr14437, fails with ICC 13.1")
26     @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr17807 Fails on FreeBSD buildbot')
27     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
28     def test_with(self):
29         """Test calling std::String member function."""
30         self.build()
31         self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
32
33         # Some versions of GCC encode two locations for the 'return' statement in main.cpp
34         lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True)
35
36         self.runCmd("run", RUN_SUCCEEDED)
37
38         self.expect("print str",
39             substrs = ['Hello world'])
40
41         # Calling this function now succeeds, but we follow the typedef return type through to
42         # const char *, and thus don't invoke the Summary formatter.
43         self.expect("print str.c_str()",
44             substrs = ['Hello world'])