I already explained what objtrees are:

http://bazaar.launchpad.net/~villemvainio/leo-editor/hashcache/annotate/head%3A/leo/doc/treecaching.txt

Now, these could be used to improve unit testing quite a bit -
basically, to ensure that subtrees (and bodies!) are exactly as they
should be without writing any code.

Let's assume we, at some point in test, call function:

leoTest.verify_subtree_at_position(p,"after-cut-paragraph")

And that's it. :-)

if we had specified leoTest.golden_run = True

verify_subtree_at_position would have *written* a snapshot of the
subtree to some file (leoTestResults.pickle / whatever) that is stored
in version control.

But, if we had

leoTest.golden_run = False

verify_subtree_at_position would have checked the current tree against
the one stored in leoTestResults, and raised exception (and failing
the test case) if there was a mismatch (gnx's in objtree ingored, of
course). So, once you have a test case that seems to work, just add
some verify_subtree_at_position's and enjoy "free" checks for the
functionality without writing (complicated & too loose) tree traversal
+ assertion code manually.

-- 
Ville M. Vainio
http://tinyurl.com/vainio

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to