On Sun, May 5, 2013 at 11:43 AM, Edward K. Ream <[email protected]> wrote:
> On Sun, May 5, 2013 at 7:37 AM, HaveF <[email protected]> wrote: > >> >> Btw, if I write test with @test, can I have a easy way to exchange with >> others who don't use leo? >> > > Yes. There is a new, not-yet-fully-documented script. See the script at > the top level of leo/scripts/scripts.leo:: > > @button write-unit-tests > > Here is the docstring: > > QQQ > This script transliterates @test nodes into test/unit_tests.py. The two > main ways of using this script are as follows:: > > TestWriter(c,path='test').run(fn='unit_tests.py') > TestWriter(c,path='test').run(fn=None) > > The first writes all tests to test/unit_tests.py; the second writes each > unit test to a separate .py file in the test directory. > > The script imports each written file and reports any syntax errors. > > A slight glitch: @test nodes must do imp.reload(stc) and imp.reload(g). > These reloads aren't needed in each test because they appear in the > file_template. It would be straightforward to have the script strip out > such cruft, but at present the script doesn't do that. > > The @auto test/unit_test.py node contains the newly-created scripts. The > next time you reload staticTypeChecking.leo all the unit tests in > unit_tests.py will be parsed into their own nodes! Not quite > round-tripping, but close enough. > QQQ > > As I reread this, the last paragraph relates to staticTypeChecking.leo, > not the script itself. I'll remove it. > Done. Also added a mention of two template sections in the TestWriter class. EKR -- 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 post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/leo-editor?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
