Open JRG-Developer opened 8 years ago
This seems to be a problem with NSObject class or required
initializers. I will look into it during the weekend and see if I can find a fix.
Cool, thanks @TadeasKriz !
If I can figure out the cause, I'll open a PR. ;)
Thanks!
From what I see, it is the logic of tokenization and generation of initializers. I probably completely forgot about custom initializers as I added class support in a bit of a hurry. Great catch! :)
Hey, @a-voronov added basic support for initializers, I'll give the dummy project a try :)
Unfortunately, no dice, it will need more work.
@TadeasKriz Thanks! Yep, there are more issues with generating mocks for classes. Protocols though seem to be generated correctly, but need to verify more edge cases.
Cuckoo.StubbingProxy
and Cuckoo.VerificationProxy
generate generic initializers with func
keywords which is incorrect.
@a-voronov I'm aware of these problems. Fortunately @FilipDolnik is working on tests for the generator, so it will be easier to test more files whether or not the generator works as expected.
Any news on the initializers issue?
It would be great to be able to Mock classes with custom initializers as this is typically heavily used in our projects or dependent frameworks where we do not have much influence on the structure.
Is there a timeline or any plans for working on this issue? Thanks!
Hey guys, new Cuckoo 0.7.0 is out with fixed initializers issue :) Sorry for the long wait.
Great Job. Thank you!
Hey guys,
I'm having an issue related to initializers, so I thought I could add it to this thread.
When generating a mock for a class with a deinit method, I'm receiving the following syntax error in GeneratedMocks.swift
-> Keyword 'deinit' cannot be used as an identifier here
I've looked at the Generator code a bit and was able to reproduce this with ./runcuckoo generate test.swift
(the test.swift being a simple swift class with a deinit method), however I'm not familiar enough with the way the GeneratedMocks.swift works to be sure I actually fix the problem.
I think it could be fixed in Generator.swift:86
, Generator.swift:113
and by adding the isDeinit
to the Token.swift
class.
Hope you can fix this or help me
@0xPr0xy check my PR. it fix deinit issue
@TadeasKriz I'm opening this issue per our discussion on
Cuckoo
repository.Per the README, CuckooGenerator supports mocks created from classes.
In my testing, however, I cannot get this to work. Rather, there are always several syntax errors.
CuckooTestDummy is a dummy test project that showcases the errors I'm seeing.