metalheadsanya / swift-mock Goto Github PK
View Code? Open in Web Editor NEWA package to simplify writing tests by automating the process of creating mock objects.
License: MIT License
A package to simplify writing tests by automating the process of creating mock objects.
License: MIT License
The generated mock methods must have the same attributes as the protocol method.
The generated mock must support primary associated types.
The macro must support correct code generation for throws properties.
This function should get mock/mocks and check, that there is no interaction with this mock/mocks at this moment.
For InOrder this should be method without arguments and check that there is no interaction with stored mocks.
Current code generation:
class TestMock: Test , Verifiable {
Should be:
class TestMock: Test, Verifiable {
The macro must support correct code generation for method escaping parameters.
The generated mock properties must have the same attributes as the protocol properties.
It is assumed that all protocol attributes should be applied to the generated mock class.
The generated mock subscript must have the same attributes as the protocol subscript.
I noticed that verify
doesn't fail the test when the call count doesn't match. I eventually figured out that there's a global closure variable, testFailureReport
, that verify
calls to report a test failure. But the testFailureReport
closure by default doesn't do anything. What's the reason for this? I also haven't found this mentioned in the documentation, that one needs to set testFailureReport
to something useful.
The macro must support correct code generation for rethrow methods.
Mock code generation should support subscript
The macro must support correct code generation for initializers.
Add section that will be explain configuration process of the engine.
Why there is need continueAfterFailure
?
How to setup verify
?
How to clean InOrder
history?
For this feature need some changes in NonEscapingFunction
type signature.
It's need to be a generic structure that use function type as a generic type.
This function should check that all interactions with mock was checked.
For InOrder this should be method and check that last there is no more interactions with passed mocks after last checked.
The macro must support correct code generation for reasync methods.
Mock macro should support correct code generation for generic methods
To enable clean separation of testing and production code it would be nice to be able to place @mock on an extension of a protocol.
Production code:
protocol MyAwesomeProtocol {
func doAmazingThings()
}
Test code:
@mock
extension MyAwesomeProtocol {}
This will add the MyAwesomeProtocolMock in the testing code instead of the production code.
Due swift language structure using any()
for ArgumentMatcher<T>
is not possible.
Instead of that framework user should use any<T>(type: T.self)
and provide type for stubbing.
We shouldn't generate default value for generic parameters.
Mock code generation should support generic where clause for associated types
Add possibility to provide return value/throws error using functions/closures.
Mock code generation should support initializer for associated types
If one sets testFailureReport
to { XCTFail($0) }
and verify
fails the test, there's no clear indication of why the test failed. One needs to go to the Issue navigator in Xcode to see the exact failure. It would be nice if the test failure pointed to the call to verify
in the test.
Mock code generation should support generic where clause for methods
The compiler should give the correct error messages why it is impossible to create a mock for the protocol at the moment.
The generated mock must support associated types.
The macro must support correct code generation for async properties.
Mock macro should support internal protocols. This kind of protocol/mock can be used with @testable import
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.