Open chshersh opened 5 years ago
Nice and convenient solution for Question 2: implement the following orphan instance in the test modules
instance (Eq msg, m ~ PureLogger msg) => Eq (LogAction m msg)
With this instance it will be very easy to compare two LogAction
s.
In order to test we also need to implement Show
instance. We can use the same approach:
instance (Show msg, m ~ PureLogger msg) => Show (LogAction m msg)
This instance will run PureLogger
and show all messages as a list.
It would be really nice to have tests for the logging functionality, especially property-based testing. However, it's not really clear how to test it. It would be really nice though to have property-based tests for laws for every data type. However, in order to do this, we need to implement the following two pieces:
LogAction
LogAction
Question 1 is still open. For Question 2: instead of comparing
LogAction
s we can compare results ofPureLogger
.We have
doctest
for unit testing, so this should be enough in terms of unit tests (though, more functions always can be covered withdoctest
). But having property-based tests for laws would be really good.Any thoughts are appreciated!