2 Test that objective-c constant strings are generated correctly by the expression
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"}
17 # Call super's setUp().
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.")
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
)
38 STOPPED_DUE_TO_BREAKPOINT
,
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")