This commit adds error checking beyond UndefVarError and fix a number of
Error/Expected related idioms:
- use (EXPECT|ASSERT)_THAT_(ERROR|EXPECTED) instead of errorToBool or boolean operator
- ASSERT when a further check require the check to be successful to give a correct result
I just realised that this and similar patterns will trigger a llvm_unreachable, if the error isn't purely a single UndefVarError (or equivalent in other places). You probably either want a generic handler that handles all error types (in addition to the error-specific one), or you want to use handleErrors and check that the returned Error is an ErrorSuccess(), e.g. EXPECT_THAT_ERROR(handleErrors(std::move(Err), /*exisitng handler*/...), Succeeded());