Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor all test cases into 'looped' tests #474

Open
RufusJWB opened this issue Sep 20, 2020 · 3 comments
Open

Refactor all test cases into 'looped' tests #474

RufusJWB opened this issue Sep 20, 2020 · 3 comments

Comments

@RufusJWB
Copy link
Contributor

@sleevi I followed your proposal and refactored test test into a loop. To make this whole thing more re-useable and minimize the amount of duplicated code, I moved the definition of the TestCase struct and of the RunTest func into https://github.com/RufusJWB/zlint/blob/master/v2/test/helpers.go . Now they can be re-used wherever needed in the code.

Originally posted by @RufusJWB in #472 (comment)

@cpu
Copy link
Member

cpu commented Sep 21, 2020

I moved the definition of the TestCase struct

I think it's fairly idiomatic to define this on a per-test basis. I wouldn't worry too much about duplication here.

I'm supportive of reworking existing tests into the "table driven" format favoured by the Go community but it's a high labour low reward task. If someone feels up to I won't try to dissuade them but it's also a lot of work without a ton of functional gains.

@RufusJWB
Copy link
Contributor Author

@cpu I'll create a branch based on this issue, so that the work I've done already will be stored and revert the changes in the #472

@cpu
Copy link
Member

cpu commented Sep 22, 2020

Thanks @RufusJWB, sorry for the churn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants