js/src/jit-test/tests/arguments/defaults-bound-to-function.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/arguments/defaults-bound-to-function.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +load(libdir + "asserts.js");
     1.5 +
     1.6 +function f(a=42) {
     1.7 +    return a;
     1.8 +    function a() { return 19; }
     1.9 +}
    1.10 +assertEq(f()(), 19);
    1.11 +function h(a=b, b=43) {
    1.12 +    return [a, b];
    1.13 +    function b() { return 42; }
    1.14 +}
    1.15 +var res = h();
    1.16 +assertEq(res[0], res[1]);
    1.17 +assertEq(res[0](), 42);
    1.18 +function i(b=FAIL) {
    1.19 +    function b() {}
    1.20 +}
    1.21 +i();
    1.22 +i(42);
    1.23 +function j(a=(b=42), b=8) {
    1.24 +    return b;
    1.25 +    function b() {}
    1.26 +}
    1.27 +assertEq(j(), 42);

mercurial