Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / objc / foundation / TestConstStrings.py
blob4d64a7c417ad164065bf1af238236bc8fc0c2b68
1 """
2 Test that objective-c constant strings are generated correctly by the expression
3 parser.
4 """
7 import lldb
8 from lldbsuite.test.decorators import *
9 from lldbsuite.test.lldbtest import *
10 from lldbsuite.test import lldbutil
13 class ConstStringTestCase(TestBase):
14 d = {"OBJC_SOURCES": "const-strings.m"}
16 def setUp(self):
17 # Call super's setUp().
18 TestBase.setUp(self)
19 # Find the line number to break inside main().
20 self.main_source = "const-strings.m"
21 self.line = line_number(self.main_source, "// Set breakpoint here.")
23 def test_break(self):
24 """Test constant string generation amd comparison by the expression parser."""
25 self.build(dictionary=self.d)
26 self.setTearDownCleanup(self.d)
28 exe = self.getBuildArtifact("a.out")
29 self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
31 lldbutil.run_break_set_by_file_and_line(
32 self, self.main_source, self.line, num_expected_locations=1, loc_exact=True
35 self.runCmd("run", RUN_SUCCEEDED)
36 self.expect(
37 "process status",
38 STOPPED_DUE_TO_BREAKPOINT,
39 substrs=[
40 "stop reason = breakpoint",
41 " at %s:%d" % (self.main_source, self.line),
45 self.expect('expression (int)[str compare:@"hello"]', startstr="(int) $0 = 0")
46 self.expect('expression (int)[str compare:@"world"]', startstr="(int) $1 = -1")
48 # Test empty strings, too.
49 self.expect('expression (int)[@"" length]', startstr="(int) $2 = 0")
51 self.expect('expression (int)[@"123" length]', startstr="(int) $3 = 3")