Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / objc / foundation / TestObjCMethodsNSError.py
blobc9e801422b46c84c3a3cdd4339d40f01cba900a6
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 FoundationTestCaseNSError(TestBase):
13 @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
14 def test_runtime_types(self):
15 """Test commands that require runtime types"""
16 self.build()
17 self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
18 self, "// Break here for NSString tests", lldb.SBFileSpec("main.m", False)
21 # Test_NSString:
22 self.runCmd("thread backtrace")
23 self.expect("expression [str length]", patterns=["\(NSUInteger\) \$.* ="])
24 self.expect("expression str.length")
25 self.expect('expression str = [NSString stringWithCString: "new"]')
26 self.expect(
27 'po [NSError errorWithDomain:@"Hello" code:35 userInfo:@{@"NSDescription" : @"be completed."}]',
28 substrs=["Error Domain=Hello", "Code=35", "be completed."],
30 self.runCmd("process continue")
32 @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
33 def test_NSError_p(self):
34 """Test that p of the result of an unknown method does require a cast."""
35 self.build()
36 self.target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
37 self, "// Set break point at this line", lldb.SBFileSpec("main.m", False)
39 self.expect(
40 "expression [NSError thisMethodIsntImplemented:0]",
41 error=True,
42 patterns=[
43 "no known method",
44 "cast the message send to the method's return type",
47 self.runCmd("process continue")