Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / objc / foundation / TestObjCMethodsString.py
blob4d8c9c960ea596e2fbeacc86cd0b9a788e9e17d9
1 """
2 Test more expression command sequences with objective-c.
3 """
6 import lldb
7 from lldbsuite.test.decorators import *
8 from lldbsuite.test.lldbtest import *
9 from lldbsuite.test import lldbutil
12 class FoundationTestCaseString(TestBase):
13 def test_NSString_expr_commands(self):
14 """Test expression commands for NSString."""
15 self.build()
16 self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
17 self, "// Break here for NSString tests", lldb.SBFileSpec("main.m", False)
20 self.runCmd("settings set target.prefer-dynamic-value no-dynamic-values")
22 # Test_NSString:
23 self.runCmd("thread backtrace")
24 self.expect("expression (int)[str length]", patterns=["\(int\) \$.* ="])
25 self.expect("expression (int)[str_id length]", patterns=["\(int\) \$.* ="])
26 self.expect("expression (id)[str description]", patterns=["\(id\) \$.* = 0x"])
27 self.expect(
28 "expression (id)[str_id description]", patterns=["\(id\) \$.* = 0x"]
30 self.expect("expression str.length")
31 self.expect('expression str = @"new"')
32 self.runCmd("image lookup -t NSString")
33 self.expect('expression str = (id)[NSString stringWithCString: "new"]')
34 self.runCmd("process continue")
36 @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
37 def test_MyString_dump_with_runtime(self):
38 """Test dump of a known Objective-C object by dereferencing it."""
39 self.build()
40 self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
41 self, "// Set break point at this line", lldb.SBFileSpec("main.m", False)
43 self.expect(
44 "expression --show-types -- *my",
45 patterns=["\(MyString\) \$.* = ", "\(MyBase\)"],
47 self.runCmd("process continue")