| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
var gTestfile = 'regress-351515.js'; |
| 7 |
|
| 8 |
var BUGNUMBER = 351515; |
| 9 |
var summary = 'Invalid uses of yield, let keywords in js17'; |
| 10 |
var actual = ''; |
| 11 |
var expect = ''; |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
test(); |
| 16 |
|
| 17 |
|
| 18 |
try |
| 19 |
{ |
| 20 |
expect = 'SyntaxError: syntax error'; |
| 21 |
eval('yield = 1;'); |
| 22 |
actual = 'No Error'; |
| 23 |
} |
| 24 |
catch(ex) |
| 25 |
{ |
| 26 |
actual = ex + ''; |
| 27 |
} |
| 28 |
reportCompare(expect, actual, summary + ': global: yield = 1'); |
| 29 |
|
| 30 |
try |
| 31 |
{ |
| 32 |
expect = 'SyntaxError: missing variable name'; |
| 33 |
eval('let = 1;'); |
| 34 |
actual = 'No Error'; |
| 35 |
} |
| 36 |
catch(ex) |
| 37 |
{ |
| 38 |
actual = ex + ''; |
| 39 |
} |
| 40 |
reportCompare(expect, actual, summary + ': global: let = 1'); |
| 41 |
|
| 42 |
function test() |
| 43 |
{ |
| 44 |
enterFunc ('test'); |
| 45 |
printBugNumber(BUGNUMBER); |
| 46 |
printStatus (summary); |
| 47 |
|
| 48 |
try |
| 49 |
{ |
| 50 |
expect = 'SyntaxError: missing formal parameter'; |
| 51 |
eval('function f(yield, let) { return yield+let; }'); |
| 52 |
actual = 'No Error'; |
| 53 |
} |
| 54 |
catch(ex) |
| 55 |
{ |
| 56 |
actual = ex + ''; |
| 57 |
} |
| 58 |
reportCompare(expect, actual, summary + |
| 59 |
': function f(yield, let) { return yield+let; }'); |
| 60 |
|
| 61 |
try |
| 62 |
{ |
| 63 |
expect = 'SyntaxError: missing variable name'; |
| 64 |
eval('var yield = 1;'); |
| 65 |
actual = 'No Error'; |
| 66 |
} |
| 67 |
catch(ex) |
| 68 |
{ |
| 69 |
actual = ex + ''; |
| 70 |
} |
| 71 |
reportCompare(expect, actual, summary + ': function () {var yield;}'); |
| 72 |
|
| 73 |
try |
| 74 |
{ |
| 75 |
expect = 'SyntaxError: missing variable name'; |
| 76 |
eval('var let = 1;'); |
| 77 |
actual = 'No Error'; |
| 78 |
} |
| 79 |
catch(ex) |
| 80 |
{ |
| 81 |
actual = ex + ''; |
| 82 |
} |
| 83 |
reportCompare(expect, actual, summary + ': function () { var let;}'); |
| 84 |
|
| 85 |
try |
| 86 |
{ |
| 87 |
expect = 'No Error'; |
| 88 |
function yield() {} |
| 89 |
actual = 'No Error'; |
| 90 |
} |
| 91 |
catch(ex) |
| 92 |
{ |
| 93 |
actual = ex + ''; |
| 94 |
} |
| 95 |
reportCompare(expect, actual, summary + ': function yield()'); |
| 96 |
|
| 97 |
exitFunc ('test'); |
| 98 |
} |