-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
This is a test that ensures the init
of a class isn't run when being stored at an @Lazy
property. The test fails (and matches what I saw in real world usage), which looks like the property is loaded eagerly.
import XCTest
@testable import LazyContainers
var shouldNotRun = false
class ShouldNotInit {
init() {
shouldNotRun = true
}
}
final class LazyContainersTests: XCTestCase {
@Lazy
var lazyShouldNotRun = ShouldNotInit()
func testLazyInitWithPropertyWrapper() {
XCTAssertFalse(shouldNotRun)
}
static var allTests = [
("testLazyInitWithPropertyWrapper", testLazyInitWithPropertyWrapper)
]
}
KyNorthstar
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working