News for hackers. Stuff that matters.
Re:Go proposal: new package to provide generic slice functions by throwaway894345 on Thursday May 06, 2021 @03:00PM (#27067698)
You aren’t testing whether exceptions propagate correctly, you test that you catch or don’t catch them appropriately just like you test whether or not you return your error appropriately. That said, doing this for every function you write is probably not going to lead to a high value test suite.
Re:Go proposal: new package to provide generic slice functions by closeparen on Thursday May 06, 2021 @03:48PM (#27068259)
“Make sure it doesn’t catch the exception” is like “make sure it doesn’t do a tap dance” - there are quite a few things a function could do, we don’t generally ask unit testing to prove negatives.
Re:Go proposal: new package to provide generic slice functions by throwaway894345 on Friday May 07, 2021 @01:33PM (#27078521)
If you’re going to check that a function propagates an error in Go it equally makes sense to check that you check to make sure the equivalent Python/etc function propagates the exception. Of course I don’t think testing either of these is a good investment.