Hacker News new | past | comments | ask | show | jobs | submit login

Alright, it's not quite as concise as I remember because you can't use arrays in a CSVSource. But I still argue that it is a vast improvement. You have your data + test condition and almost nothing on top.

Code: https://pastebin.com/14hLe6Fz

And now all of the horribleness of requiring a struct definition + defining the data inside your method + for loop is gone. The intend is clear and based upon your liking you can move the test data into a separate class, at the end of the file or next to the test case.

PS: I just realized you can't edit your post after 1+ hours have passed!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: