buildasaurs / XcodeServerSDK

Access Xcode Server API with native Swift objects.
MIT License
399 stars 30 forks source link

Testing public/internal/private methods #52

Closed cojoj closed 9 years ago

cojoj commented 9 years ago

I assume that public is in every XcodeServerSDK class because of Swift 1.2 leftovers? I mean from testing point of view. But now, with Swift 2 we were blessed with this beautiful @testable annotation, so why not Zoidberg?

IMHO, classes like JSON, HTTPUtils and some more are not meant to be used out of internal scope, so we definitely can remove public access. Why do you think?

czechboy0 commented 9 years ago

Yes. I'm even tempted to make everything private and then make what needs to be internal and public, so that we have a minimal public interface. Can you use @testable on private methods as well? Or is it just for internal?

cojoj commented 9 years ago

Just for internals... 😭 I even started this twitter conversation once.

czechboy0 commented 9 years ago

Ok, so let's do this: keep indirectly tested methods as private and directly tested ones as internal or public. In a way treat internal and public as things you'd put in a header file. But, always default to internal and only make it public iff you have a usecase outside of the current module.

And we will try to test all internal and public methods. So this task is mainly about removing the public modifier to make it internal again. Does that make sense?

cojoj commented 9 years ago

Yes sir, I think that's the right way! Now, Beats1 and get back to work 😉

czechboy0 commented 9 years ago

Haha same here. Loving the London style that's on right now.

cojoj commented 9 years ago

Oh man... Wish I'm in London right now 🇬🇧 Love this city so much 😻

czechboy0 commented 9 years ago

It's fucking boiling here right now though. :sweat:

cojoj commented 9 years ago

Even though... 😆