~ubuntu-branches/ubuntu/trusty/mozjs17/trusty

« back to all changes in this revision

Viewing changes to js/src/jit-test/tests/arguments/defaults-strict-mode.js

  • Committer: Package Import Robot
  • Author(s): Rico Tzschichholz
  • Date: 2013-05-25 12:24:23 UTC
  • Revision ID: package-import@ubuntu.com-20130525122423-zmxucrhtensw90xy
Tags: upstream-17.0.0
ImportĀ upstreamĀ versionĀ 17.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
load(libdir + "asserts.js");
 
2
 
 
3
function f1(f=(function () { return typeof this !== "object"; })) { "use strict"; return f; }
 
4
assertEq(f1()(), true);
 
5
function f2(f=(function () { "use strict"; return (function () { return typeof this !== "object"; }) })) { assertEq(typeof this, "object"); return f; }
 
6
assertEq(f2()()(), true);
 
7
function f3(f=(function () { return (function () { return typeof this !== "object"; }) })) { "use strict"; return f; }
 
8
assertEq(f3()()(), true);
 
9
// These should be okay.
 
10
function f4(f=(function () { with (Object) {} }), g=(function () { "use strict"; })) {}
 
11
function f5(g=(function () { "use strict"; }), f=(function () { with (Object) {} })) {}
 
12
function f6(f=(function () { return (x for (y in (function g() {}))); })) {}
 
13
 
 
14
assertThrowsInstanceOf(function () {
 
15
    eval("function f(a=delete x) { 'use strict'; }");
 
16
}, SyntaxError);
 
17
assertThrowsInstanceOf(function () {
 
18
    Math.sin(4);
 
19
    eval("function f(a='\\251') { 'use strict'; }");
 
20
}, SyntaxError);
 
21
assertThrowsInstanceOf(function () {
 
22
    eval("function f(a='\\251', b=delete x) { 'use strict'; }");
 
23
}, SyntaxError);
 
24
assertThrowsInstanceOf(function () {
 
25
    eval("function f(a=delete x, b='\\251') { 'use strict'; }");
 
26
}, SyntaxError);
 
27
assertThrowsInstanceOf(function () {
 
28
    eval("function f(a=(function () { '\\251'; })) { 'use strict'; }");
 
29
}, SyntaxError);
 
30
assertThrowsInstanceOf(function () {
 
31
    eval("function f(a=(function () { with (Object) {} })) { 'use strict'; }");
 
32
}, SyntaxError);
 
33
assertThrowsInstanceOf(function () {
 
34
    eval("function f(a=(function (b, b) {})) { 'use strict'; }");
 
35
}, SyntaxError);