As of rev 4471, Leo's execute-script command sets g.app.inScript when
executing a script. This variable enables the following testing
pattern that may appear in Leo own source files:
class aClass:
<whatever>
if g.app.inScript:
aClass(c).test()
This pattern allows me to test the code within Leo *without reloading
leo* just by using the execute-script command. The point is that this
pattern is much more convenient than enabling testing with::
if 1:
aClass(c).test()
Indeed, if I forget to change "if 1:" to "if 0:" when saving my work,
Leo will crash during the import of the file because "c" is not
defined.
This new pattern allows testing code to be integrated safely into
Leo's sources--a significant step forward.
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.