js/src/tests/js1_8/genexps/regress-683738.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/. */
     7 //-----------------------------------------------------------------------------
     8 var BUGNUMBER = 683738;
     9 var summary = 'return with argument and lazy generator detection';
    10 var actual = '';
    11 var expect = '';
    13 //-----------------------------------------------------------------------------
    14 test();
    15 //-----------------------------------------------------------------------------
    17 function test()
    18 {
    19   enterFunc ('test');
    20   printBugNumber(BUGNUMBER);
    21   printStatus (summary);
    23   expect = "generator function foo returns a value";
    24   try
    25   {
    26     actual = 'No Error';
    27     eval("function foo(x) { if (x) { return this; } else { yield 3; } }");
    28   }
    29   catch(ex)
    30   {
    31     actual = ex.message;
    32   }
    33   reportCompare(expect, actual, summary + ": 1");
    35   expect = "generator function foo returns a value";
    36   try
    37   {
    38     actual = 'No Error';
    39     eval("function foo(x) { if (x) { yield 3; } else { return this; } }");
    40   }
    41   catch(ex)
    42   {
    43     actual = ex.message;
    44   }
    45   reportCompare(expect, actual, summary + ": 2");
    47   expect = "generator function foo returns a value";
    48   try
    49   {
    50     actual = 'No Error';
    51     eval("function foo(x) { if (x) { return this; } else { (yield 3); } }");
    52   }
    53   catch(ex)
    54   {
    55     actual = ex.message;
    56   }
    57   reportCompare(expect, actual, summary + ": 3");
    59   expect = "generator function foo returns a value";
    60   try
    61   {
    62     actual = 'No Error';
    63     eval("function foo(x) { if (x) { (yield 3); } else { return this; } }");
    64   }
    65   catch(ex)
    66   {
    67     actual = ex.message;
    68   }
    69   reportCompare(expect, actual, summary + ": 4");
    71 }

mercurial