blob: 736af5b6334056029b762b957ae47f081c0da02d [file] [log] [blame]
Johnny Chenb146ad52011-05-19 21:28:24 +00001"""
2Test calling std::String member functions.
3"""
4
Zachary Turner77db4a82015-10-22 20:06:20 +00005import lldb_shared
6
Johnny Chenb146ad52011-05-19 21:28:24 +00007import lldb
8import lldbutil
9from lldbtest import *
10
11class ExprCommandCallFunctionTestCase(TestBase):
12
Greg Clayton4570d3e2013-12-10 23:19:29 +000013 mydir = TestBase.compute_mydir(__file__)
Johnny Chenb146ad52011-05-19 21:28:24 +000014
15 def setUp(self):
16 # Call super's setUp().
17 TestBase.setUp(self)
18 # Find the line number to break for main.c.
19 self.line = line_number('main.cpp',
20 '// Please test these expressions while stopped at this line:')
21
Matt Kopec9c990302013-08-02 17:53:28 +000022 @expectedFailureIcc # llvm.org/pr14437, fails with ICC 13.1
Tamas Berghammerc8fd1302015-09-30 10:12:40 +000023 @expectedFailureFreeBSD('llvm.org/pr17807') # Fails on FreeBSD buildbot
Zachary Turner608cb822015-09-11 20:00:00 +000024 @expectedFailureWindows("llvm.org/pr21765")
Tamas Berghammerc8fd1302015-09-30 10:12:40 +000025 def test_with(self):
Johnny Chenb146ad52011-05-19 21:28:24 +000026 """Test calling std::String member function."""
Tamas Berghammerc8fd1302015-09-30 10:12:40 +000027 self.build()
Johnny Chenb146ad52011-05-19 21:28:24 +000028 self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
29
Matt Kopecc51b2432013-03-01 17:29:16 +000030 # Some versions of GCC encode two locations for the 'return' statement in main.cpp
31 lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=True)
Johnny Chenb146ad52011-05-19 21:28:24 +000032
Sean Callanan05834cd2015-07-01 23:56:30 +000033 self.runCmd("run", RUN_SUCCEEDED)
Johnny Chenb146ad52011-05-19 21:28:24 +000034
35 self.expect("print str",
36 substrs = ['Hello world'])
37
Jim Ingham8e522092014-03-19 00:30:31 +000038 # Calling this function now succeeds, but we follow the typedef return type through to
39 # const char *, and thus don't invoke the Summary formatter.
Johnny Chenb146ad52011-05-19 21:28:24 +000040 self.expect("print str.c_str()",
41 substrs = ['Hello world'])