js/src/tests/ecma_5/strict/15.3.4.5.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/tests/ecma_5/strict/15.3.4.5.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,26 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +
     1.6 +/*
     1.7 + * Any copyright is dedicated to the Public Domain.
     1.8 + * http://creativecommons.org/licenses/publicdomain/
     1.9 + */
    1.10 +
    1.11 +function strict() { 'use strict'; return this; }
    1.12 +function lenient() { return this; }
    1.13 +var obj = {};
    1.14 +
    1.15 +assertEq(strict.bind(true)(), true);
    1.16 +assertEq(strict.bind(42)(), 42);
    1.17 +assertEq(strict.bind("")(), "");
    1.18 +assertEq(strict.bind(null)(), null);
    1.19 +assertEq(strict.bind(undefined)(), undefined);
    1.20 +assertEq(strict.bind(obj)(), obj);
    1.21 +
    1.22 +assertEq(lenient.bind(true)() instanceof Boolean, true);
    1.23 +assertEq(lenient.bind(42)() instanceof Number, true);
    1.24 +assertEq(lenient.bind("")() instanceof String, true);
    1.25 +assertEq(lenient.bind(null)(), this);
    1.26 +assertEq(lenient.bind(undefined)(), this);
    1.27 +assertEq(lenient.bind(obj)(), obj);
    1.28 +
    1.29 +reportCompare(true, true);

mercurial