~ubuntu-branches/ubuntu/vivid/mozjs24/vivid

« back to all changes in this revision

Viewing changes to js/src/tests/js1_8/genexps/regress-683738.js

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2014-02-11 21:55:34 UTC
  • Revision ID: package-import@ubuntu.com-20140211215534-m1zyq5aj59md3y07
Tags: upstream-24.2.0
ImportĀ upstreamĀ versionĀ 24.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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/. */
 
5
 
 
6
 
 
7
//-----------------------------------------------------------------------------
 
8
var BUGNUMBER = 683738;
 
9
var summary = 'return with argument and lazy generator detection';
 
10
var actual = '';
 
11
var expect = '';
 
12
 
 
13
//-----------------------------------------------------------------------------
 
14
test();
 
15
//-----------------------------------------------------------------------------
 
16
 
 
17
function test()
 
18
{
 
19
  enterFunc ('test');
 
20
  printBugNumber(BUGNUMBER);
 
21
  printStatus (summary);
 
22
 
 
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");
 
34
 
 
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");
 
46
 
 
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");
 
58
 
 
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");
 
70
 
 
71
}