43 lines · python
1"""2Test calling std::String member functions.3"""4 5import lldb6from lldbsuite.test.decorators import *7from lldbsuite.test.lldbtest import *8from lldbsuite.test import lldbutil9 10 11class ExprCommandCallFunctionTestCase(TestBase):12 @expectedFailureAll(13 compiler="icc", bugnumber="llvm.org/pr14437, fails with ICC 13.1"14 )15 @skipIf(compiler="clang", compiler_version=["<", "9.0"])16 def test_with(self):17 """Test calling std::String member function."""18 self.build()19 lldbutil.run_to_source_breakpoint(20 self, "// break here", lldb.SBFileSpec("main.cpp")21 )22 23 self.expect("expression str", substrs=["Hello world"])24 25 # Calling this function now succeeds, but we follow the typedef return type through to26 # const char *, and thus don't invoke the Summary formatter.27 28 # clang's libstdc++ on ios arm64 inlines std::string::c_str() always;29 # skip this part of the test.30 triple = self.dbg.GetSelectedPlatform().GetTriple()31 do_cstr_test = True32 if triple in [33 "arm64-apple-ios",34 "arm64e-apple-ios",35 "arm64-apple-tvos",36 "armv7k-apple-watchos",37 "arm64-apple-bridgeos",38 "arm64_32-apple-watchos",39 ]:40 do_cstr_test = False41 if do_cstr_test:42 self.expect("expression str.c_str()", substrs=["Hello world"])43