2 ms·
Honestly, determining that all methods that start with "test" are your unit tests is pretty bad. We do this because this was the most obvious solution in obj-c.
by eridius 10y ago
Honestly, determining that all methods that start with "test" are your unit tests is pretty bad. We do this because this was the most obvious solution in obj-c. A much better Swift solution is to instead use an attribute, such as `@test`, to mark test functions. This requires compiler support for now, but the long-term goal could then be to come up with a generic way of declaring and handling attributes.
- phink 10y agoIt's not just methods starting with test, it's methods starting with test in a subclass of Test. It's a simple, working convention. Conventions are good, not pretty bad. Adding more stuff to the language only makes it more complex and requires more effort. I don't see this as a much better solution but as an over engineered one, as much of what Apple is doing these days.