The ekr-unit-test branch contains the work for
#1766: cover Leo with unit tests. Work is well along, as shown by
PR #2159.
In this Engineering Notebook post, I'll say a few words about converting the unit tests for @shadow. These unit tests are arguably the most important because they test the @shadow update algorithm.
The unit tests are also (by far) the most difficult to translate into "flat" (traditional/new) unit tests. Indeed, the @shadow update algorithm uses an actual Leo outline as part of its data. So the new unit tests must do likewise.
The ConvertShadowTests.convert_node script is in convertCommands.py. convert_node is part of a larger script that converts @test nodes from unitTest.leo to traditional unit tests. Doing the conversion by hand is out of the question. I must be free to experiment with the contents of each unit test. Altering tests by hand would be tedious and way error-prone.
convert_node creates nodes that pass unit tests. That's not bad, but I suspect that the tests aren't testing what I think they should. The only way to know for sure is to study what the existing unit tests do. I'll tweak convert_node as needed to ensure that the unit tests actually do what the old tests did!
Summary
The old unit tests use actual outline data. The new unit tests will recreate this data.
The old tests were functional tests, not coverage tests. For Leo's @shadow code, functional tests are much more important than coverage tests. However, coverage tests will act as an additional check on the unit tests.
For example, suppose I had naively assumed that all was well just because all the new tests passed. Coverage testing might reveal that all the new tests are actually the same test!
Edward