Improve test precision

Previously, some tests verified two independent concerns simultaneously:
syntactic validity and runtime completion value. The former is relevant
for ECMAScript runtimes and parsers alike, but the latter is only
observable by runtimes.

Express expectations regarding syntactic validity using literal program
code so they can be used by parsers. Maintain the original tests which
rely on eval in order to preserve coverage for statement completion
values.
This commit is contained in:
Mike Pennisi 2019-03-31 21:38:44 -04:00
parent aa4c533d28
commit 159bcc7bad
9 changed files with 80 additions and 77 deletions

View File

@ -1,26 +0,0 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: |
The result of evaluating "for( ExpNoIn;Exp;Exp)" loop is returning
(normal, evalValue, empty)
es5id: 12.6.3_A9.1
description: Using eval
---*/
var supreme, count;
supreme=5;
//////////////////////////////////////////////////////////////////////////////
//CHECK#
try {
var __evaluated = eval("for(count=0;;) {if (count===supreme)break;else count++; }");
if (__evaluated !== void 0) {
$ERROR('#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated );
}
} catch (e) {
$ERROR('#1: var __evaluated = eval("for(count=0;;) {if (count===supreme)break;else count++; }"); does not lead to throwing exception');
}
//
//////////////////////////////////////////////////////////////////////////////

View File

@ -1,26 +0,0 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: |
The result of evaluating "for(var ExpNoIn;Exp;Exp)" loop is returning
(normal, evalValue, empty)
es5id: 12.6.3_A9
description: Using eval
---*/
var supreme;
supreme=5;
//////////////////////////////////////////////////////////////////////////////
//CHECK#
try {
var __evaluated = eval("for(var count=0;;) {if (count===supreme)break;else count++; }");
if (__evaluated !== void 0) {
$ERROR('#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated );
}
} catch (e) {
$ERROR('#1: var __evaluated = eval("for(var count=0;;) {if (count===supreme)break;else count++; }"); does not lead to throwing exception');
}
//
//////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,17 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: |
The result of evaluating "for( ExpNoIn;Exp;Exp)" loop is returning
(normal, evalValue, empty)
es5id: 12.6.3_A9.1
description: Using eval
---*/
var supreme, count;
supreme=5;
var __evaluated = eval("for(count=0;;) {if (count===supreme)break;else count++; }");
assert.sameValue(__evaluated, void 0, '#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated);

View File

@ -0,0 +1,13 @@
// Copyright 2019 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: For head may omit optional expressions
es5id: 12.6.3_A9.1
---*/
var supreme = 5
var count;
for(count=0;;) {if (count===supreme)break;else count++; }

View File

@ -0,0 +1,16 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: |
The result of evaluating "for(var ExpNoIn;Exp;Exp)" loop is returning
(normal, evalValue, empty)
es5id: 12.6.3_A9
description: Using eval
---*/
var supreme=5;
var __evaluated = eval("for(var count=0;;) {if (count===supreme)break;else count++; }");
assert.sameValue(__evaluated, void 0, '#1: __evaluated === 4. Actual: __evaluated ==='+ __evaluated );

View File

@ -0,0 +1,11 @@
// Copyright 2019 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: For head may omit optional expressions
es5id: 12.6.3_A9
---*/
var supreme=5;
for(var count=0;;) {if (count===supreme)break;else count++; }

View File

@ -1,25 +0,0 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: |
In the "if" statement empty statement is allowed and is evaluated to
"undefined"
es5id: 12.5_A7
description: Checking by using eval "eval("if(1);"))"
---*/
//////////////////////////////////////////////////////////////////////////////
//CHECK#1
try {
var __evaluated = eval("if(1);");
if (__evaluated !== undefined) {
$ERROR('#1: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated );
}
} catch (e) {
$ERROR('#1.1: "__evaluated = eval("if(1);")" does not lead to throwing exception');
}
//
//////////////////////////////////////////////////////////////////////////////

View File

@ -0,0 +1,14 @@
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: |
In the "if" statement empty statement is allowed and is evaluated to
"undefined"
es5id: 12.5_A7
description: Checking by using eval "eval("if(1);"))"
---*/
var __evaluated = eval("if(1);");
assert.sameValue(__evaluated, undefined, '#1: __evaluated === undefined. Actual: __evaluated ==='+ __evaluated);

View File

@ -0,0 +1,9 @@
// Copyright 2019 Mike Pennisi. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: In the "if" statement empty statement is allowed.
es5id: 12.5_A7
---*/
if(1);