-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from RougeWare/bugfix/20-Lazy-property-wrapper…
…-eagerly-evaluated Bodge guarding against issue #20
- Loading branch information
Showing
6 changed files
with
141 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// GitHubIssue20Tests.swift | ||
// LazyContainersTests | ||
// | ||
// Created by Gabe Shahbazian on 2020-07-29. | ||
// | ||
|
||
import XCTest | ||
@testable import LazyContainers | ||
|
||
|
||
|
||
#if swift(>=5.3) | ||
var shouldNotRun = false | ||
|
||
class ShouldNotInit { | ||
init() { | ||
shouldNotRun = true | ||
} | ||
} | ||
|
||
|
||
|
||
/// Guards against issue #20 | ||
/// https://github.com/RougeWare/Swift-Lazy-Patterns/issues/20 | ||
final class GitHubIssue20Tests: XCTestCase { | ||
|
||
@Lazy | ||
var lazyShouldNotRun = ShouldNotInit() | ||
|
||
func testLazyInitWithPropertyWrapper() { | ||
XCTAssertFalse(shouldNotRun) | ||
} | ||
|
||
static var allTests = [ | ||
("testLazyInitWithPropertyWrapper", testLazyInitWithPropertyWrapper) | ||
] | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters