The recent problems with crashes in the log pane were due to a
complete botch when I created the logCtrl (and bodyCtrl) properties:
the properties both got the name "b" rather than the intended names.
A proper unit test would have caught that mistake. Indeed, a proper
unit test would have been the development scaffold for creating these
properties, but I created the code a few days ago when I wasn't using
unit tests for *everything*.
Anyway, once I discovered the cause of the bug I wanted to come up
with a proper unit test that would demonstrate that the bug is gone.
It took awhile. Afaik, there is no obvious test to tell whether a
symbol 'x' is a property.
I discovered a clean enough test after my workout this afternoon.
Here is the unit test for logCtrl, on the trunk at rev 4831::
# Test that changing c.frame.log.logCtrl changes
c.frame.log.widget.
log = c.frame.log
old_w = log.widget
assert old_w is not None
try:
log.logCtrl = None
assert log.widget is None
finally:
log.widget = old_w
This is an indirect test that logCtrl isn't a normal ivar: changing
it also changes log.widget. That should be good enough to prove that
logCtrl is a property with the expected effect.
However, there is another test that I would like to create, and it may
become the first real use of the leoInspect module. The real
intention of the logCtrl property is that there be *no* assignment to
logCtrl anywhere in Leo. That is, log.logCtrl is basically a macro
that expands to log.widget. All assignment happen to log.widget, not
log.logCtrl.
This is a perfect prototype for leoInspect inferences. It is a simple
*textual* property that reflects how I created and understand the
code. Verifying this property should be easy using leoInspect, and
difficult or impossible using any other tool.
In short, while I am far from happy about the logCtrl blunder, it has
had the happy side effect of suggesting the first unit test based on
leoInspect. I hope to have the test ready in a day or so.
Edward
--
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.