On Mon, Oct 31, 2011 at 8:34 AM, Edward K. Ream <[email protected]> wrote:
> As of rev 4690, Leo supports "hidden" unit tests. This just may be
> the missing piece of Leo's unit testing arsenal.
There is a collapse in complexity here that I just discovered: use
Alt-4 for all tests.
Here is the background to make sense of this:
1. Running unit tests externally is on the road to deprecation. Local
(hidden) unit tests are much simple to use and write, and local unit
tests are *much* faster to execute. I'll probably never get rid of
these tests, but there will be no longer be any key bindings for them.
2. A new aha: the as-yet-unwritten run-marked-unit-tests-locally is
the simplest thing that could possibly work. Bind Alt-4 to this
command, marked just the desired tests and then run them with one
keystroke. Brilliantly simple.
Experience shows that being able to run the desired unit tests
*without* selecting any particular node makes an amazingly large
difference. Being able to run all and only marked unit tests is a big
step forward.
3. We want three kinds of (local) unit tests::
run-all-unit-tests-locally
run-selected-unit-tests-locally
run-marked-unit-tests-locally
At present, run-selected-unit-tests-locally is called
run-unit-tests-locally: that name must change.
The collapse in complexity is this:
unitTest.leo: bind Alt-4 to run-selected-unit-tests-locally
leoPy.leo: bind Alt-4 to run-marked-unit-tests-locally
Edward
P.S. Here is the unit test that started this train of thought::
def tokenize(self.c):
(Definition omitted)
if g.unitTesting:
import leo.core.leoImport as leoImport
sc = leoImport.pythonScanner(c.importCommands,atAuto=False)
aList = tokenize(sc,p.b)
s2 = ''.join([val for (kind,val,n) in aList])
assert p.b == s2
Note: tokenize is a method of baseScannerClass. Calling tokenize with
self = sc suffices *without* having to monkey-patch anything. Details
omitted. In other situations, monkey-patching will be natural.
EKR
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.