Skip to content

Commit 3d18cab

Browse files
committed
Add tests
1 parent 0bfcd54 commit 3d18cab

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ SwiftLanguage::GetMethodNameVariants(ConstString method_name) const {
148148
// in type `A`). Second, it can refer the *getter* block for property `A`.
149149
// LLDB's baseline behavior handles the first case. The second case is
150150
// produced here as a variant name.
151-
for (StringRef suffix : {".get", ".set", ".willSet", ".didSet"})
151+
for (StringRef suffix : {".get", ".set", ".willset", ".didset"})
152152
if (method_name.GetStringRef().ends_with(suffix)) {
153153
// The method name, complete with suffix, *is* the variant.
154154
variant_names.emplace_back(method_name, eFunctionNameTypeFull |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
SWIFT_SOURCES := main.swift
3+
4+
include Makefile.rules
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""
2+
"""
3+
4+
import lldb
5+
from lldbsuite.test.lldbtest import *
6+
from lldbsuite.test.decorators import *
7+
8+
9+
class TestCase(TestBase):
10+
@swiftTest
11+
def test(self):
12+
self.build()
13+
exe = self.getBuildArtifact("a.out")
14+
target = self.dbg.CreateTarget(exe)
15+
for name in (
16+
"read_only.get",
17+
"read_write.get",
18+
"read_write.set",
19+
"observed.willset",
20+
"observed.didset",
21+
):
22+
bp = target.BreakpointCreateByName(name)
23+
self.assertEqual(len(bp.locations), 1, name)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
struct Thing {
2+
var read_only: Int { 22 + 15 }
3+
4+
var read_write: Int {
5+
get { 23 + 41 }
6+
set { print("nothing") }
7+
}
8+
9+
var observed: Int {
10+
willSet { print("willSet") }
11+
didSet { print("didSet") }
12+
}
13+
}

0 commit comments

Comments
 (0)