4 ms·
This is useful for testing. Currently, I need to write both the string name of the text and an identifier based on that name for the function itself. Soon I wil
by rcruzeiro 1y ago
This is useful for testing. Currently, I need to write both the string name of the text and an identifier based on that name for the function itself. Soon I will only need to write it once. This is not much useful for much else though, and just because you can write code like this, it does not mean you should.
- 90s_dev 1y agoA better solution is to have a testing framework that doesn't rely on functions to name tests, especially in a language that has anonymous functions.
- rcruzeiro 1y agoWe have Quick for this — and while this framework is still a reasonable choice of a testing framework, I personally feel like the new Swift Testing framework is much nicer to write my test cases with. https://github.com/Quick/Quick https://github.com/Quick/Quick
- wingerlang 1y agoWhy do you need both an identifier and a text? I have this test name 'testAddingNewCardDataResultsInProperlyCombinedCardDataButNoNewCardsUnlocksBecauseWeStillHaveUnlearnedCards', and even though it is much longer than my other ones, it is still perfectly readable, and even if it wasn't, the only time I actually have to read it, is if it fails.