Skip to content

Commit e37ef10

Browse files
committed
Add test to verify no cycle between view and flex
1 parent ccd2025 commit e37ef10

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

FlexLayoutTests/FlexLayoutTests.swift

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,15 @@ import XCTest
1515

1616
class FlexLayoutTests: XCTestCase {
1717

18-
override func setUp() {
19-
super.setUp()
20-
// Put setup code here. This method is called before the invocation of each test method in the class.
21-
}
22-
23-
override func tearDown() {
24-
// Put teardown code here. This method is called after the invocation of each test method in the class.
25-
super.tearDown()
26-
}
27-
28-
func testExample() {
29-
// This is an example of a functional test case.
30-
// Use XCTAssert and related functions to verify your tests produce the correct results.
31-
}
32-
33-
func testPerformanceExample() {
34-
// This is an example of a performance test case.
35-
self.measure {
36-
// Put the code you want to measure the time of here.
37-
}
18+
func testRetainCycle() {
19+
weak var weakView: UIView? = nil
20+
_ = { _ in
21+
let strongView = UIView()
22+
strongView.flex.direction(.column)
23+
weakView = strongView
24+
}()
25+
26+
XCTAssertNil(weakView, "Creation of flex should not lead to retain cycle")
3827
}
3928

4029
}

0 commit comments

Comments
 (0)