-
Notifications
You must be signed in to change notification settings - Fork 86
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 #235 from sidepelican/existential_any
Wrap underlyingType if the type has existential any
- Loading branch information
Showing
7 changed files
with
75 additions
and
11 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
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,8 @@ | ||
import Foundation | ||
|
||
class ExistentialAnyTests: MockoloTestCase { | ||
func testForArgFuncs() { | ||
verify(srcContent: existentialAny, | ||
dstContent: existentialAnyMock) | ||
} | ||
} |
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,51 @@ | ||
let existentialAny = """ | ||
/// \(String.mockAnnotation) | ||
protocol ExistentialAny { | ||
var foo: P { get } | ||
var bar: any R<Int> { get } | ||
var baz: any P & Q { get } | ||
var qux: (any P) -> any P { get } | ||
} | ||
""" | ||
|
||
let existentialAnyMock = | ||
""" | ||
class ExistentialAnyMock: ExistentialAny { | ||
init() { } | ||
init(foo: P, bar: any R<Int>, baz: any P & Q, qux: @escaping (any P) -> any P) { | ||
self._foo = foo | ||
self._bar = bar | ||
self._baz = baz | ||
self._qux = qux | ||
} | ||
private(set) var fooSetCallCount = 0 | ||
private var _foo: P! { didSet { fooSetCallCount += 1 } } | ||
var foo: P { | ||
get { return _foo } | ||
set { _foo = newValue } | ||
} | ||
private(set) var barSetCallCount = 0 | ||
private var _bar: (any R<Int>)! { didSet { barSetCallCount += 1 } } | ||
var bar: any R<Int> { | ||
get { return _bar } | ||
set { _bar = newValue } | ||
} | ||
private(set) var bazSetCallCount = 0 | ||
private var _baz: (any P & Q)! { didSet { bazSetCallCount += 1 } } | ||
var baz: any P & Q { | ||
get { return _baz } | ||
set { _baz = newValue } | ||
} | ||
private(set) var quxSetCallCount = 0 | ||
private var _qux: ((any P) -> any P)! { didSet { quxSetCallCount += 1 } } | ||
var qux: (any P) -> any P { | ||
get { return _qux } | ||
set { _qux = newValue } | ||
} | ||
} | ||
""" |