Skip to content

Commit 88368b3

Browse files
committed
Add test for addTarget selector.
1 parent bdd6931 commit 88368b3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Tests/XcodeTests/iOSProject/iOSProject/XibViewController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ class XibViewController: UIViewController {
88

99
override func viewDidLoad() {
1010
super.viewDidLoad()
11-
_ = #selector(targetMethod)
11+
_ = #selector(selectorMethod)
12+
button.addTarget(self, action: #selector(addTargetMethod), for: .touchUpInside)
1213
}
1314

14-
@objc private func targetMethod() {}
15+
@objc private func selectorMethod() {}
16+
@objc private func addTargetMethod() {}
1517
}
1618

1719
struct XibViewControllerWrapper: UIViewControllerRepresentable {

Tests/XcodeTests/iOSProjectTest.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ class iOSProjectTest: SourceGraphTestCase {
9090
#endif
9191

9292
func testRetainsMethodReferencedByObjcSelector() {
93-
XCTAssertReferenced((.functionMethodInstance, "targetMethod()"), descendentOf: (.class, "XibViewController"))
93+
XCTAssertReferenced((.functionMethodInstance, "selectorMethod()"), descendentOf: (.class, "XibViewController"))
94+
XCTAssertReferenced((.functionMethodInstance, "addTargetMethod()"), descendentOf: (.class, "XibViewController"))
9495
}
9596

9697
func testMultiTargetFile() {

0 commit comments

Comments
 (0)