This Engineering notebook post records Ahas that arose in confronting 
#3181 <https://github.com/leo-editor/leo-editor/issues/3181>. These Ahas 
may seem small, but there is no such thing as a small Aha!

*Aha:* Start with the unit test.

Reading the code of *g.findUNL* put me to sleep. g.findUNL is part of an 
inherently complex ecosystem. 

Improving  *test_g_findUnl* woke me up. This unit test now contains smaller 
sub-tests of *all *the possible UNLs that can arise from error messages. 
These sub-tests allowed me to focus on more manageable issues.

*Aha*: The unit test should test all expected error messages.


Each tool (flake8, mypy, pyflakes, pylint, and python) uses a different 
format for its error message. Tests should cover each.


Similarly, the recently-improved unit test for *LM.scanOptions* tests all 
variations of Leo's command-line options, both valid and invalid.


*Aha:* All error messages (regardless of the tool that generates the test) 
contain the full *absolute* path to the erroneous file.


*Summary*


- Working on a unit test is a great way to get into action.

- TDD works for study as well as development and testing.

  Let's call this approach *TDS: test-driven study*.

- 100% code coverage is not always enough.

  Tests should cover all options.


Edward

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/b4995963-ba92-4214-95c0-0595f10df916n%40googlegroups.com.

Reply via email to