[DEV-7160] Do not allow terminating classifications for test runner

master
Austin Schaffer 2020-03-09 12:21:32 -04:00
parent 940d41817f
commit 433fc01e77
3 changed files with 27 additions and 9 deletions

View File

@ -20,7 +20,7 @@
</classify> </classify>
<t:assert failure="Retrying suppliers are ineligible" <t:assert failure="Retrying suppliers are ineligible"
neg-yields="_nassert-supplier-pending"> as="-assert-supplier-pending">
<t:match-eq on="__retry" value="FALSE" /> <t:match-eq on="__retry" value="FALSE" />
</t:assert> </t:assert>
</template> </template>

View File

@ -38,6 +38,11 @@ module.exports = Class( 'TestCase',
return this._caseData.description || ""; return this._caseData.description || "";
}, },
get allow_failures()
{
return this._caseData.allow_failures || false;
},
get data() get data()
{ {
return this._caseData.data || {}; return this._caseData.data || {};
@ -72,9 +77,10 @@ module.exports = Class( 'TestCase',
} ); } );
return module.exports( { return module.exports( {
description: this.description, description: this.description,
data: new_data, allow_failures: this.allow_failures,
expect: new_expect, data: new_data,
expect: new_expect,
} ); } );
}, },

View File

@ -111,10 +111,22 @@ module.exports = Class( 'TestRunner',
* *
* @return {Object<desc,i,total,failures>} test results * @return {Object<desc,i,total,failures>} test results
*/ */
'protected runTest'( { description: desc, data, expect }, test_i, total ) 'protected runTest'(
{ {
description: desc,
allow_failures,
data,
expect,
},
test_i,
total
) {
const can_term = ( typeof allow_failures === 'string' )
? !( allow_failures.toLowerCase() === 'true')
: !allow_failures;
// no input map---#rate uses params directly // no input map---#rate uses params directly
const result = this._tryRun( data ); const result = this._tryRun( data, can_term );
const cmp = Object.keys( expect ).map( const cmp = Object.keys( expect ).map(
field => [ field => [
@ -163,14 +175,14 @@ module.exports = Class( 'TestRunner',
* *
* @return {Object|Error} result or error * @return {Object|Error} result or error
*/ */
'private _tryRun'( data ) 'private _tryRun'( data, can_term )
{ {
// no input map---#rate uses params directly // no input map---#rate uses params directly
try try
{ {
this._verifyKnownParams( data ); this._verifyKnownParams( data );
return this._program.rater( data ).vars; return this._program.rater( data, can_term ).vars;
} }
catch( e ) catch( e )
{ {