Rework CLI modules and tests
While investigating how we could test the Daemon.hs module, I realisedthat we have a very, erm, sub-optimal situation:
- HTools/CLI.hs has a nice IO/pure separation testing in cmdline parsing, which allows some basic functionality to be tested, but...
Fix deserialisation bug in ResultEntry
Found via the newly added unit-tests, which test most of theserialisation code in Query/Language (except for QueryResult, forwhich we already tests both sub-components separately).
Signed-off-by: Iustin Pop <iustin@google.com>...
Add query filter tests
These tests are node specific only because we don't have other querytypes implemented yet, but what they actually test is the variousfilter types.
The tests are trying to cover most filter functionality; missing fornow is proper checking for ContainsFilter and TrueFilter, the rest...
Add some unittests for node queries
These new tests check that:
- no known fields return unknown- any unknown field returns unknown- the type of the fields is consistent between the getters and the field definition- the length of each result row corresponds with the number of fields...
Add a small 'passTest' helper
This is symmetric to failTest, and allows us to use it in cases wherewe need to return a property.
While replacing 'property True' with it, I saw a case where we cansimplify the use and thus reworked that check.
Add entire ConfigData serialisation tests
Using the recently-added genArbitrary, we can now implement Arbitraryinstances for even "huge" objects like Cluster, so let's use that toimplement entire ConfigData serialisation tests.
Note that, as we don't have yet proper types for some of the Params...
Replace manual arbitrary instances with genArbitrary
There are a few more that could be replaces, once we start usingappropriate (new)types.
Signed-off-by: Iustin Pop <iustin@google.com>Reviewed-by: René Nussbaumer <rn@google.com>
Introduce a helper for simple Arbitrary instances
After getting really annoyed at yet another "<*> arbitrary", I thoughtthat we should be able to automate this, at least for types which aresimple enough and have already all the "prerequisites".
Hence the new genArbitrary function and its helpers, which can:...
Add Instance serialisations tests
This is not perfect, as for many of the parameters we don't have goodArbitrary instances, but is better than nothing.
Add a test helper for simple JSON serialisation testing
While adding yet another JSON serialisation test, I realised that thiscan be trivially abstracted; hence this patch, replacing both simpleversions (readJSON . showJSON == id) and the standard version (with...
View revisions
Also available in: Atom