js/src/tests/js1_7/geniter/regress-345855.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 //-----------------------------------------------------------------------------
     7 var BUGNUMBER = 345855;
     8 var summary = 'Blank yield expressions are not syntax errors';
     9 var actual = '';
    10 var expect = 'No Error';
    13 //-----------------------------------------------------------------------------
    14 test();
    15 //-----------------------------------------------------------------------------
    17 function test()
    18 {
    19   enterFunc ('test');
    20   printBugNumber(BUGNUMBER);
    21   printStatus (summary);
    23   expect = "SyntaxError";
    24   try
    25   {
    26     eval('(function() {x = 12 + yield;})');
    27     actual = 'No Error';
    28   }
    29   catch(ex)
    30   {
    31     actual = ex.name;
    32   }
    33   reportCompare(expect, actual, summary + ': function() {x = 12 + yield;}');
    35   expect = "SyntaxError";
    36   try
    37   {
    38     eval('(function() {x = 12 + yield 42})');
    39     actual = 'No Error';
    40   }
    41   catch(ex)
    42   {
    43     actual = ex.name;
    44   }
    45   reportCompare(expect, actual, summary + ': function() {x = 12 + yield 42}');
    47   expect = 'No Error';
    48   try
    49   {
    50     eval('(function() {x = 12 + (yield);})');
    51     actual = 'No Error';
    52   }
    53   catch(ex)
    54   {
    55     actual = ex + '';
    56   }
    57   reportCompare(expect, actual, summary + ': function() {x = 12 + (yield);}');
    59   try
    60   {
    61     eval('(function () {foo((yield))})');
    62     actual = 'No Error';
    63   }
    64   catch(ex)
    65   {
    66     actual = ex + '';
    67   }
    68   reportCompare(expect, actual, summary + ': function () {foo((yield))}');
    70   try
    71   {
    72     eval('(function() {x = 12 + (yield 42)})');
    73     actual = 'No Error';
    74   }
    75   catch(ex)
    76   {
    77     actual = ex + '';
    78   }
    79   reportCompare(expect, actual, summary + ': function() {x = 12 + (yield 42)}');
    81   try
    82   {
    83     eval('(function (){foo((yield 42))})');
    84     actual = 'No Error';
    85   }
    86   catch(ex)
    87   {
    88     actual = ex + '';
    89   }
    90   reportCompare(expect, actual, summary + ': function (){foo((yield 42))}');
    92   exitFunc ('test');
    93 }

mercurial