Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAustin Schaffer <austin.schaffer@ryansg.com>2020-03-12 13:04:43 -0400
committerAustin Schaffer <austin.schaffer@ryansg.com>2020-03-12 13:04:43 -0400
commit5f3ccc6894f0a0769d0ed96ff928480a7ff896d5 (patch)
tree2479972c558be32e9643bdee52649190ff188ad0
parent2434e138b830edd05e45d07e6f90d157e736623f (diff)
parent433fc01e77dce17ac119d5263180352e1367822a (diff)
downloadtame-5f3ccc6894f0a0769d0ed96ff928480a7ff896d5.tar.gz
tame-5f3ccc6894f0a0769d0ed96ff928480a7ff896d5.tar.bz2
tame-5f3ccc6894f0a0769d0ed96ff928480a7ff896d5.zip
Allow yaml tests to evaluate assertions and prohibits
-rw-r--r--core/retry.xml3
-rw-r--r--progtest/src/TestCase.js12
-rw-r--r--progtest/src/TestRunner.js22
3 files changed, 28 insertions, 9 deletions
diff --git a/core/retry.xml b/core/retry.xml
index 41afbbe..069f2c6 100644
--- a/core/retry.xml
+++ b/core/retry.xml
@@ -19,7 +19,8 @@
<param-copy name="@values@" />
</classify>
- <t:assert failure="Retrying suppliers are ineligible">
+ <t:assert failure="Retrying suppliers are ineligible"
+ as="-assert-supplier-pending">
<t:match-eq on="__retry" value="FALSE" />
</t:assert>
</template>
diff --git a/progtest/src/TestCase.js b/progtest/src/TestCase.js
index 7d69457..9258caf 100644
--- a/progtest/src/TestCase.js
+++ b/progtest/src/TestCase.js
@@ -38,6 +38,11 @@ module.exports = Class( 'TestCase',
return this._caseData.description || "";
},
+ get allow_failures()
+ {
+ return this._caseData.allow_failures || false;
+ },
+
get data()
{
return this._caseData.data || {};
@@ -72,9 +77,10 @@ module.exports = Class( 'TestCase',
} );
return module.exports( {
- description: this.description,
- data: new_data,
- expect: new_expect,
+ description: this.description,
+ allow_failures: this.allow_failures,
+ data: new_data,
+ expect: new_expect,
} );
},
diff --git a/progtest/src/TestRunner.js b/progtest/src/TestRunner.js
index ac172d0..a969e49 100644
--- a/progtest/src/TestRunner.js
+++ b/progtest/src/TestRunner.js
@@ -111,10 +111,22 @@ module.exports = Class( 'TestRunner',
*
* @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
- const result = this._tryRun( data );
+ const result = this._tryRun( data, can_term );
const cmp = Object.keys( expect ).map(
field => [
@@ -163,14 +175,14 @@ module.exports = Class( 'TestRunner',
*
* @return {Object|Error} result or error
*/
- 'private _tryRun'( data )
+ 'private _tryRun'( data, can_term )
{
// no input map---#rate uses params directly
try
{
this._verifyKnownParams( data );
- return this._program.rater( data ).vars;
+ return this._program.rater( data, can_term ).vars;
}
catch( e )
{