On Saturday, November 16, 2019 at 8:30:35 AM UTC-6, Edward K. Ream wrote:
>
> The fstring branch now contains a more flexible test runner.  It's 
> signature is:
>
> def test_token_traversers(contents, reports=None):
>

Some updates:

1. It's now called "test_runner" :-)

2. A *driver script,* in my personal .leo file, calls the test runner.  
Here it is:

import imp
import leo.core.leoAst as leoAst
imp.reload(leoAst)

use_file = False
path = r'C:\leo.repo\leo-editor\leo\core\runLeo.py'
<< define contents >>
contents = contents.strip() + '\n'
reports = [
    # 'coverage',
    # 'fail-fast',
    # 'contents',
    # 'tokens',
    # 'results',
    'diff',
    'assign-links',
    # 'lines',
    'tokens',
    'results',
    'tree',
    'summary',
]
# Run the tests.
leoAst.test_runner(contents, reports)

The driver contains several useful improvements:

1. There is only one list of switches.

In practice, I am continually enabling or disabling switches, so having 
each switch on a single line is convenient. A single list eliminates 
confusion.

2. There are two new switches, "fail-fast" and "no-fail-fast".

The test runner sets or clears its fail_fast var when it sees these. The 
runner exits its main loop (and reports failure) when a test fails and 
fail_fast is true.

Multiple "fail-fast" and "no-fail-switches" could exist in the list of 
switches, though at present there is only one real test.

3. The list of contents has been "off-loaded" to the << define contents >> 
section.

This foreshadows a single @test node that will get constituent unit tests 
from child nodes.

Headlines in the children will indicate whether the body text contain 
actual source code, or points to a source file, or maybe even a directory 
of files to test.

*Summary*

This is, by far, the most flexible test runner I have ever used.

The driver shown above will be the basis for a single @test node that runs 
a suite of constituent tests defined by its children.

Edward

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/507a0055-fd9f-4c0f-8701-fa1bcd08ee53%40googlegroups.com.

Reply via email to