Comments (5)
@andlang - I have fixed that issue, its waiting for code review. I think it will not be released as 1.3 bug fix, but along with version 2.0, which should be available in next few days. Updating release date for the end of the week, but it might be sooner.
In general, that how the test added looks like now. Please note, that there is a requirement to register all custom Type's in order of matcher working fine. Also - in that particular case there is literally no difference between using .value and .any for T.Type attribute.
func test_custom_type_constraint() {
let mock = GenericProtocolWithTypeConstraintMock()
let data = Data()
let otherData = Data(count: 20)
XCTAssertNotEqual(data, otherData)
// Required to allow Type matching! Basic types like Int.self, Bool.self etc have already registered comparators
Matcher.default.register(CustomThing.Type.self)
Given(mock, .decode(type: .value(Int.self), from: .any, willReturn: 0))
Given(mock, .decode(type: .value(Int.self), from: .value(data), willReturn: 1))
Given(mock, .decode(type: .any(CustomThing.Type.self), from: .any, willReturn: CustomThing(id: 0)))
Given(mock, .decode(type: .any(CustomThing.Type.self), from: .value(data), willReturn: CustomThing(id: 1)))
XCTAssertEqual(mock.decode(Int.self, from: otherData), 0)
XCTAssertEqual(mock.decode(Int.self, from: data), 1)
XCTAssertEqual(mock.decode(CustomThing.self, from: otherData).id, 0)
XCTAssertEqual(mock.decode(CustomThing.self, from: data).id, 1)
}
from swiftymocky.
@andlang - quick update, code get merged. New version will be available this week I think. I'm marking issue as done.
from swiftymocky.
@andlang Version 2.0 is ready, feel free to check it out :)
from swiftymocky.
Checking that, we might have issues with .Type
- if so, I'll start fixing it right away. Thanks for the info.
from swiftymocky.
Perfect, it works! Thank you very much!
from swiftymocky.
Related Issues (20)
- Computed vars do not write to invocation array in a threadsafe way
- Compilation Performance Issues HOT 2
- Mock generation failure for Swift Package when using actor objects in package HOT 3
- Feature Request: View controller and view mocking support.
- Missing parenthesis optional existential type (any ProtocolName) properties
- Mock a protocol in an SPM dependency framework.
- Feature request: Allow partial mocks for testable subclasses
- Stubber with factory behavior
- Invalid redeclaration error in .generated file while using tuples with typealias
- Can't Download CLI tool
- generate command fails on xcode cloud HOT 1
- Use XCTestDynamicOverlay
- _InternalSwiftSyntaxParser is missing again HOT 2
- Issue with ShellOut dependency with SPM HOT 1
- How to add generated file with swiftlint rules in version 4.2.0 with new Mockfile format HOT 1
- There is no fallback data, if no 'Given` method provided. HOT 1
- How to include swift package file in mockfile
- cannot decode object of class (SwiftActor) for key (NS.objects) because no class named "SwiftActor" was found HOT 2
- outdated Sourcery version (1.8.0) doesn't build on macos ventura (apple silicon)
- Conflict with swift-openapi-generator
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftymocky.