diff options
author | David Fugate <dfugate@microsoft.com> | 2011-03-09 12:00:57 -0800 |
---|---|---|
committer | David Fugate <dfugate@microsoft.com> | 2011-03-09 12:00:57 -0800 |
commit | 0eb3f27bf9ef049aa6694369d7873213871fe181 (patch) | |
tree | 697c05347df2157aaaf1226ac811910df24dbab5 /test/suite/ietestcenter/chapter15/15.3 | |
parent | 2e0481cc8c01f2af37a42ba7aff5b8c4a3563eb6 (diff) | |
download | test262-0eb3f27bf9ef049aa6694369d7873213871fe181.tar.gz |
Added IE Test Center test case contributions to test/suite/ietestcenter.
Diffstat (limited to 'test/suite/ietestcenter/chapter15/15.3')
93 files changed, 4045 insertions, 0 deletions
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-1.js new file mode 100644 index 000000000..5ea6464ab --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-1.js @@ -0,0 +1,35 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.2.1-11-1",
+
+path: "TestCases/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-1.js",
+
+description: "Duplicate separate parameter name in Function constructor allowed if body not strict",
+
+test: function testcase()
+{
+ Function('a','a','return;');
+ return true;
+ }
+
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-3.js b/test/suite/ietestcenter/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-3.js new file mode 100644 index 000000000..25cc5f6df --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-3.js @@ -0,0 +1,33 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.2.1-11-3",
+
+path: "TestCases/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-3.js",
+
+description: "Function constructor may have a formal parameter named 'eval' if body is not strict mode",
+
+test: function testcase() {
+ Function('eval', 'return;');
+ return true;
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-5.js b/test/suite/ietestcenter/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-5.js new file mode 100644 index 000000000..37296f419 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-5.js @@ -0,0 +1,34 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.2.1-11-5",
+
+path: "TestCases/chapter15/15.3/15.3.2/15.3.2.1/15.3.2.1-11-5.js",
+
+description: "Duplicate combined parameter name in Function constructor allowed if body is not strict",
+
+test: function testcase()
+{
+ Function('a,a','return;');
+ return true;
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.3/15.3.3.2/15.3.3.2-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.3/15.3.3.2/15.3.3.2-1.js new file mode 100644 index 000000000..98d45995f --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.3/15.3.3.2/15.3.3.2-1.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.3.2-1",
+
+path: "TestCases/chapter15/15.3/15.3.3/15.3.3.2/15.3.3.2-1.js",
+
+description: "Function.length - data property with value 1",
+
+test: function testcase() {
+
+ var desc = Object.getOwnPropertyDescriptor(Function,"length");
+ if(desc.value === 1 &&
+ desc.writable === false &&
+ desc.enumerable === false &&
+ desc.configurable === false)
+ return true;
+
+ },
+
+precondition: function () {
+ return fnExists(Object.getOwnPropertyDescriptor);
+ }
+
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-1.js new file mode 100644 index 000000000..01c6b40df --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-1.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-1",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-1.js",
+
+ description: "[[Call]] - 'F''s [[BoundArgs]] is used as the former part of arguments of calling the [[Call]] internal method of 'F''s [[TargetFunction]] when 'F' is called",
+
+ test: function testcase() {
+ var func = function (x, y, z) {
+ return x + y + z;
+ };
+
+ var newFunc = Function.prototype.bind.call(func, {}, "a", "b", "c");
+
+ return newFunc() === "abc";
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-10.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-10.js new file mode 100644 index 000000000..62af1e1f2 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-10.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-10",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-10.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 1, length of 'boundArgs' is 0, length of 'ExtraArgs' is 0, and with 'boundThis'",
+
+ test: function testcase() {
+ var obj = { prop: "abc" };
+
+ var func = function (x) {
+ return this === obj && typeof x === "undefined";
+ };
+
+ var newFunc = Function.prototype.bind.call(func, obj);
+
+ return newFunc();
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-11.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-11.js new file mode 100644 index 000000000..65468c970 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-11.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-11",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-11.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 1, length of 'boundArgs' is 0, length of 'ExtraArgs' is 1, and with 'boundThis'",
+
+ test: function testcase() {
+ var obj = { prop: "abc" };
+
+ var func = function (x) {
+ return this === obj && x === 1 && arguments[0] === 1 && arguments.length === 1 && this.prop === "abc";
+ };
+
+ var newFunc = Function.prototype.bind.call(func, obj);
+
+ return newFunc(1);
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-12.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-12.js new file mode 100644 index 000000000..111a89e32 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-12.js @@ -0,0 +1,45 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-12",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-12.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 1, length of 'boundArgs' is 0, length of 'ExtraArgs' is 2, and with 'boundThis'",
+
+ test: function testcase() {
+ var obj = { prop: "abc" };
+
+ var func = function (x) {
+ return this === obj && x === 1 && arguments[1] === 2 &&
+ arguments[0] === 1 && arguments.length === 2 && this.prop === "abc";
+ };
+
+ var newFunc = Function.prototype.bind.call(func, obj);
+
+ return newFunc(1, 2);
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-13.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-13.js new file mode 100644 index 000000000..fae62ee47 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-13.js @@ -0,0 +1,45 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-13",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-13.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 1, length of 'boundArgs' is 1, length of 'ExtraArgs' is 0, and with 'boundThis'",
+
+ test: function testcase() {
+ var obj = { prop: "abc" };
+
+ var func = function (x) {
+ return this === obj && x === 1 &&
+ arguments[0] === 1 && arguments.length === 1 && this.prop === "abc";
+ };
+
+ var newFunc = Function.prototype.bind.call(func, obj, 1);
+
+ return newFunc();
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-14.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-14.js new file mode 100644 index 000000000..b5ece02df --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-14.js @@ -0,0 +1,45 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-14",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-14.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 1, length of 'boundArgs' is 1, length of 'ExtraArgs' is 1, and with 'boundThis'",
+
+ test: function testcase() {
+ var obj = { prop: "abc" };
+
+ var func = function (x) {
+ return this === obj && x === 1 && arguments[1] === 2
+ arguments[0] === 1 && arguments.length === 2 && this.prop === "abc";
+ };
+
+ var newFunc = Function.prototype.bind.call(func, obj, 1);
+
+ return newFunc(2);
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-15.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-15.js new file mode 100644 index 000000000..05f337643 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-15.js @@ -0,0 +1,45 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-15",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-15.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 1, length of 'boundArgs' is 2, length of 'ExtraArgs' is 0, and with 'boundThis'",
+
+ test: function testcase() {
+ var obj = { prop: "abc" };
+
+ var func = function (x) {
+ return this === obj && x === 1 && arguments[1] === 2 &&
+ arguments[0] === 1 && arguments.length === 2 && this.prop === "abc";
+ };
+
+ var newFunc = Function.prototype.bind.call(func, obj, 1, 2);
+
+ return newFunc();
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-2.js new file mode 100644 index 000000000..0caf2022c --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-2.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-2",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-2.js",
+
+ description: "[[Call]] - 'F''s [[BoundThis]] is used as the 'this' value of calling the [[Call]] internal method of 'F''s [[TargetFunction]] when 'F' is called",
+
+ test: function testcase() {
+ var obj = { "prop": "a" };
+
+ var func = function () {
+ return this;
+ };
+
+ var newFunc = Function.prototype.bind.call(func, obj);
+
+ return newFunc() === obj;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-3.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-3.js new file mode 100644 index 000000000..272ebb200 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-3.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-3",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-3.js",
+
+ description: "[[Call]] - the provided arguments is used as the latter part of arguments of calling the [[Call]] internal method of 'F''s [[TargetFunction]] when 'F' is called",
+
+ test: function testcase() {
+ var func = function (x, y, z) {
+ return z;
+ };
+
+ var newFunc = Function.prototype.bind.call(func, {}, "a", "b");
+
+ return newFunc("c") === "c";
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-4.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-4.js new file mode 100644 index 000000000..d64b4ed77 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-4.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-4",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-4.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 0, length of 'boundArgs' is 0, length of 'ExtraArgs' is 0, and without 'boundThis'",
+
+ test: function testcase() {
+ var func = function () {
+ return arguments.length === 0;
+ };
+
+ var newFunc = Function.prototype.bind.call(func);
+
+ return newFunc();
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-5.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-5.js new file mode 100644 index 000000000..cdd59173a --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-5.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-5",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-5.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 0, length of 'boundArgs' is 0, length of 'ExtraArgs' is 1, and without 'boundThis'",
+
+ test: function testcase() {
+ var func = function () {
+ return arguments[0] === 1;
+ };
+
+ var newFunc = Function.prototype.bind.call(func);
+
+ return newFunc(1);
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-6.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-6.js new file mode 100644 index 000000000..52c1fa62b --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-6.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-6",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-6.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 0, length of 'boundArgs' is 0, length of 'ExtraArgs' is 0, and with 'boundThis'",
+
+ test: function testcase() {
+ var obj = { prop: "abc" };
+
+ var func = function () {
+ return this === obj && arguments.length === 0;
+ };
+
+ var newFunc = Function.prototype.bind.call(func, obj);
+
+ return newFunc();
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-7.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-7.js new file mode 100644 index 000000000..5beeeb6f3 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-7.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-7",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-7.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 0, length of 'boundArgs' is 1, length of 'ExtraArgs' is 0, and with 'boundThis'",
+
+ test: function testcase() {
+ var obj = { prop: "abc" };
+
+ var func = function () {
+ return this === obj && arguments[0] === 1;
+ };
+
+ var newFunc = Function.prototype.bind.call(func, obj, 1);
+
+ return newFunc();
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-8.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-8.js new file mode 100644 index 000000000..d4cad8aff --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-8.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-8",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-8.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 0, length of 'boundArgs' is 0, length of 'ExtraArgs' is 1, and with 'boundThis'",
+
+ test: function testcase() {
+ var obj = { prop: "abc" };
+
+ var func = function () {
+ return this === obj && arguments[0] === 1;
+ };
+
+ var newFunc = Function.prototype.bind.call(func, obj);
+
+ return newFunc(1);
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-9.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-9.js new file mode 100644 index 000000000..006b92546 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.1/15.3.4.5.1-4-9.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.1-4-9",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.1/15.3.4.5.1-4-9.js",
+
+ description: "[[Call]] - length of parameters of 'target' is 0, length of 'boundArgs' is 1, length of 'ExtraArgs' is 1, and with 'boundThis'",
+
+ test: function testcase() {
+ var obj = { prop: "abc" };
+
+ var func = function () {
+ return this === obj && arguments[0] === 1 && arguments[1] === 2;
+ };
+
+ var newFunc = Function.prototype.bind.call(func, obj, 1);
+
+ return newFunc(2);
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-1.js new file mode 100644 index 000000000..e85ba665a --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-1.js @@ -0,0 +1,48 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-1",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-1.js",
+
+ description: "[[Construct]] - 'F''s [[BoundArgs]] is used as the former part of arguments of calling the [[Construct]] internal method of 'F''s [[TargetFunction]] when 'F' is called as constructor",
+
+ test: function testcase() {
+ var func = function (x, y, z) {
+ var objResult = {};
+ objResult.returnValue = x + y + z;
+ objResult.returnVerifyResult = arguments[0] === "a" && arguments.length === 3;
+ return objResult;
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, {}, "a", "b", "c");
+
+ var newInstance = new NewFunc();
+
+ return newInstance.hasOwnProperty("returnValue") && newInstance.returnValue === "abc" &&
+ newInstance.hasOwnProperty("returnVerifyResult") && newInstance.returnVerifyResult === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-10.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-10.js new file mode 100644 index 000000000..b0a1c14fc --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-10.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-10",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-10.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 1, length of 'boundArgs' is 0, length of 'ExtraArgs' is 1",
+
+ test: function testcase() {
+ var func = function (x) {
+ return new Boolean(arguments.length === 1 && x === 1 && arguments[0] === 1);
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, {});
+
+ var newInstance = new NewFunc(1);
+
+ return newInstance.valueOf() === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-11.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-11.js new file mode 100644 index 000000000..6113fabf3 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-11.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-11",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-11.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 1, length of 'boundArgs' is 0, length of 'ExtraArgs' is 2",
+
+ test: function testcase() {
+ var func = function (x) {
+ return new Boolean(arguments.length === 2 && x === 1 && arguments[1] === 2 && arguments[0] === 1);
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, {});
+
+ var newInstance = new NewFunc(1, 2);
+
+ return newInstance.valueOf() === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-12.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-12.js new file mode 100644 index 000000000..97b54b9b8 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-12.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-12",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-12.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 1, length of 'boundArgs' is 1, length of 'ExtraArgs' is 0",
+
+ test: function testcase() {
+ var func = function (x) {
+ return new Boolean(arguments.length === 1 && x === 1 && arguments[0] === 1);
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, {}, 1);
+
+ var newInstance = new NewFunc();
+
+ return newInstance.valueOf() === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-13.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-13.js new file mode 100644 index 000000000..c1f885dfc --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-13.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-13",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-13.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 1, length of 'boundArgs' is 1, length of 'ExtraArgs' is 1",
+
+ test: function testcase() {
+ var func = function (x) {
+ return new Boolean(arguments.length === 2 && x === 1 && arguments[1] === 2 && arguments[0] === 1);
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, {}, 1);
+
+ var newInstance = new NewFunc(2);
+
+ return newInstance.valueOf() === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-14.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-14.js new file mode 100644 index 000000000..e6ac9ea24 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-14.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-14",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-14.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 1, length of 'boundArgs' is 2, length of 'ExtraArgs' is 0",
+
+ test: function testcase() {
+ var func = function (x) {
+ return new Boolean(arguments.length === 2 && x === 1 && arguments[1] === 2 && arguments[0] === 1);
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, {}, 1, 2);
+
+ var newInstance = new NewFunc();
+
+ return newInstance.valueOf() === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-2.js new file mode 100644 index 000000000..f689d2e7e --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-2.js @@ -0,0 +1,48 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-2",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-2.js",
+
+ description: "[[Construct]] - the provided arguments is used as the latter part of arguments of calling the [[Construct]] internal method of 'F''s [[TargetFunction]] when 'F' is called as constructor",
+
+ test: function testcase() {
+ var func = function (x, y, z) {
+ var objResult = {};
+ objResult.returnValue = x + y + z;
+ objResult.returnVerifyResult = arguments[0] === "a" && arguments.length === 3;
+ return objResult;
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, {});
+
+ var newInstance = new NewFunc("a", "b", "c");
+
+ return newInstance.hasOwnProperty("returnValue") && newInstance.returnValue === "abc" &&
+ newInstance.hasOwnProperty("returnVerifyResult") && newInstance.returnVerifyResult === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-3.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-3.js new file mode 100644 index 000000000..c017e3a1a --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-3.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-3",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-3.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 0, length of 'boundArgs' is 0, length of 'ExtraArgs' is 0, and without 'boundThis'",
+
+ test: function testcase() {
+ var func = function () {
+ return new Boolean(arguments.length === 0);
+ };
+
+ var NewFunc = Function.prototype.bind.call(func);
+
+ var newInstance = new NewFunc();
+
+ return newInstance.valueOf() === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-4.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-4.js new file mode 100644 index 000000000..f5014179f --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-4.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-4",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-4.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 0, length of 'boundArgs' is 0, length of 'ExtraArgs' is 1, and without 'boundThis'",
+
+ test: function testcase() {
+ var func = function () {
+ return new Boolean(arguments[0] === 1 && arguments.length === 1);
+ };
+
+ var NewFunc = Function.prototype.bind.call(func);
+
+ var newInstance = new NewFunc(1);
+
+ return newInstance.valueOf() === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-5.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-5.js new file mode 100644 index 000000000..82fef551c --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-5.js @@ -0,0 +1,52 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-5",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-5.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 0, length of 'boundArgs' is 0, length of 'ExtraArgs' is 0, and with 'boundThis'",
+
+ test: function testcase() {
+ var obj = { prop: "abc" };
+
+ try {
+ Object.prototype.verifyThis = "verifyThis";
+ var func = function () {
+ return new Boolean(arguments.length === 0 && Object.prototype.toString.call(this) === "[object Object]" &&
+ this.verifyThis === "verifyThis");
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, obj);
+
+ var newInstance = new NewFunc();
+
+ return newInstance.valueOf();
+ } finally {
+ delete Object.prototype.verifyThis;
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-6.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-6.js new file mode 100644 index 000000000..6d32855f8 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-6.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-6",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-6.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 0, length of 'boundArgs' is 1, length of 'ExtraArgs' is 0",
+
+ test: function testcase() {
+ var func = function () {
+ return new Boolean(arguments.length === 1 && arguments[0] === 1);
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, {}, 1);
+
+ var newInstance = new NewFunc();
+
+ return newInstance.valueOf() === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-7.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-7.js new file mode 100644 index 000000000..8ecef9135 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-7.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-7",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-7.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 0, length of 'boundArgs' is 0, length of 'ExtraArgs' is 1",
+
+ test: function testcase() {
+ var func = function () {
+ return new Boolean(arguments.length === 1 && arguments[0] === 1);
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, {});
+
+ var newInstance = new NewFunc(1);
+
+ return newInstance.valueOf() === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-8.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-8.js new file mode 100644 index 000000000..140b3bf26 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-8.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-8",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-8.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 0, length of 'boundArgs' is 1, length of 'ExtraArgs' is 1",
+
+ test: function testcase() {
+ var func = function () {
+ return new Boolean(arguments.length === 2 && arguments[0] === 1 && arguments[1] === 2);
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, {}, 1);
+
+ var newInstance = new NewFunc(2);
+
+ return newInstance.valueOf() === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-9.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-9.js new file mode 100644 index 000000000..6fee87b92 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5.2/15.3.4.5.2-4-9.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5.2-4-9",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5.2/15.3.4.5.2-4-9.js",
+
+ description: "[[Construct]] - length of parameters of 'target' is 1, length of 'boundArgs' is 0, length of 'ExtraArgs' is 0",
+
+ test: function testcase() {
+ var func = function (x) {
+ return new Boolean(arguments.length === 0 && typeof x === "undefined");
+ };
+
+ var NewFunc = Function.prototype.bind.call(func, {});
+
+ var newInstance = new NewFunc();
+
+ return newInstance.valueOf() === true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-0-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-0-1.js new file mode 100644 index 000000000..192fd499f --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-0-1.js @@ -0,0 +1,36 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-0-1",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-0-1.js",
+
+description: "Function.prototype.bind must exist as a function",
+
+test: function testcase() {
+ var f = Function.prototype.bind;
+
+ if (typeof(f) === "function") {
+ return true;
+ }
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-0-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-0-2.js new file mode 100644 index 000000000..834b9cb08 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-0-2.js @@ -0,0 +1,38 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-0-2",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-0-2.js",
+
+description: "Function.prototype.bind must exist as a function taking 1 parameter",
+
+test: function testcase() {
+ if (Function.prototype.bind.length === 1) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-10-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-10-1.js new file mode 100644 index 000000000..5cd7efcf0 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-10-1.js @@ -0,0 +1,40 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-10-1",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-10-1.js",
+
+ description: "Function.prototype.bind - internal property [[Class]] of 'F' is set as Function",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ return Object.prototype.toString.call(obj) === "[object Function]";
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-11-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-11-1.js new file mode 100644 index 000000000..fec378dc5 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-11-1.js @@ -0,0 +1,45 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-11-1",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-11-1.js",
+
+ description: "Function.prototype.bind - internal property [[Prototype]] of 'F' is set as Function.prototype",
+
+ test: function testcase() {
+
+ var foo = function () { };
+ try {
+ Function.prototype.property = 12;
+ var obj = foo.bind({});
+
+ return obj.property === 12;
+ } finally {
+ delete Function.prototype.property;
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-1.js new file mode 100644 index 000000000..43bcd3432 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-1.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-13.b-1",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-1.js",
+
+description: "Function.prototype.bind, bound fn has a 'length' own property",
+
+test: function testcase() {
+ function foo() { }
+ var o = {};
+
+ var bf = foo.bind(o);
+ if (bf.hasOwnProperty('length')) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-2.js new file mode 100644 index 000000000..24cac3133 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-2.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-13.b-2",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-2.js",
+
+description: "Function.prototype.bind, 'length' set to remaining number of expected args",
+
+test: function testcase() {
+ function foo(x, y) { }
+ var o = {};
+
+ var bf = foo.bind(o);
+ if (bf.length === 2) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-3.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-3.js new file mode 100644 index 000000000..4a36dca37 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-3.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-13.b-3",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-3.js",
+
+description: "Function.prototype.bind, 'length' set to remaining number of expected args (all args prefilled)",
+
+test: function testcase() {
+ function foo(x, y) { }
+ var o = {};
+
+ var bf = foo.bind(o, 42, 101);
+ if (bf.length === 0) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-4.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-4.js new file mode 100644 index 000000000..816abf5fd --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-4.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-13.b-4",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-4.js",
+
+description: "Function.prototype.bind, 'length' set to remaining number of expected args (target takes 0 args)",
+
+test: function testcase() {
+ function foo() { }
+ var o = {};
+
+ var bf = foo.bind(o);
+ if (bf.length === 0) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-5.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-5.js new file mode 100644 index 000000000..bf2ada7a8 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-5.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-13.b-5",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-5.js",
+
+description: "Function.prototype.bind, 'length' set to remaining number of expected args (target provided extra args)",
+
+test: function testcase() {
+ function foo() { }
+ var o = {};
+
+ var bf = foo.bind(o, 42);
+ if (bf.length === 0) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-6.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-6.js new file mode 100644 index 000000000..66b1ad12b --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-6.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-13.b-6",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-13.b-6.js",
+
+description: "Function.prototype.bind, 'length' set to remaining number of expected args",
+
+test: function testcase() {
+ function foo(x, y) { }
+ var o = {};
+
+ var bf = foo.bind(o, 42);
+ if (bf.length === 1) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-1.js new file mode 100644 index 000000000..93243c44d --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-1.js @@ -0,0 +1,45 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-15-1",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-1.js",
+
+description: "Function.prototype.bind, 'length' is a data valued own property",
+
+test: function testcase() {
+ function foo() { }
+ var o = {};
+
+ var bf = foo.bind(o);
+ var desc = Object.getOwnPropertyDescriptor(bf, 'length');
+ if (desc.hasOwnProperty('value') === true &&
+ desc.hasOwnProperty('get') === false &&
+ desc.hasOwnProperty('set') === false) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.getOwnPropertyDescriptor);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-2.js new file mode 100644 index 000000000..bea5e9445 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-2.js @@ -0,0 +1,46 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-15-2",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-2.js",
+
+description: "Function.prototype.bind, 'length' is a data valued own property with default attributes (false)",
+
+test: function testcase() {
+ function foo() { }
+ var o = {};
+
+ var bf = foo.bind(o);
+ var desc = Object.getOwnPropertyDescriptor(bf, 'length');
+ if (desc.value === 0 &&
+ desc.enumerable === false &&
+ desc.writable === false &&
+ desc.configurable == false) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.getOwnPropertyDescriptor);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-3.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-3.js new file mode 100644 index 000000000..3873607c1 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-3.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-15-3",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-3.js",
+
+ description: "Function.prototype.bind - The [[Writable]] attribute of length property in F set as false",
+
+ test: function testcase() {
+
+ var canWritable = false;
+ var hasProperty = false;
+ function foo() { }
+ var obj = foo.bind({});
+ hasProperty = obj.hasOwnProperty("length");
+ obj.length = 100;
+ canWritable = (obj.length === 100);
+ return hasProperty && !canWritable;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-4.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-4.js new file mode 100644 index 000000000..dc2c4a973 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-4.js @@ -0,0 +1,47 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-15-4",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-4.js",
+
+ description: "Function.prototype.bind - The [[Enumerable]] attribute of length property in F set as false",
+
+ test: function testcase() {
+
+ var canEnumerable = false;
+ var hasProperty = false;
+ function foo() { }
+ var obj = foo.bind({});
+ hasProperty = obj.hasOwnProperty("length");
+ for (var prop in obj) {
+ if (prop === "length") {
+ canEnumerable = true;
+ }
+ }
+ return hasProperty && !canEnumerable;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-5.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-5.js new file mode 100644 index 000000000..88f5e2bc5 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-5.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-15-5",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-15-5.js",
+
+ description: "Function.prototype.bind - The [[Configurable]] attribute of length property in F set as false",
+
+ test: function testcase() {
+
+ var canConfigurable = false;
+ var hasProperty = false;
+ function foo() { }
+ var obj = foo.bind({});
+ hasProperty = obj.hasOwnProperty("length");
+ delete obj.caller;
+ canConfigurable = !obj.hasOwnProperty("length");
+ return hasProperty && !canConfigurable;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-16-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-16-1.js new file mode 100644 index 000000000..439ff83d9 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-16-1.js @@ -0,0 +1,43 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-16-1",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-16-1.js",
+
+description: "Function.prototype.bind, [[Extensible]] of the bound fn is true",
+
+test: function testcase() {
+ function foo() { }
+ var o = {};
+
+ var bf = foo.bind(o);
+ var ex = Object.isExtensible(bf);
+ if (ex === true) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.getOwnPropertyDescriptor);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-16-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-16-2.js new file mode 100644 index 000000000..2c4b204be --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-16-2.js @@ -0,0 +1,40 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-16-2",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-16-2.js",
+
+ description: "Function.prototype.bind - The [[Extensible]] attribute of internal property in F set as true",
+
+ test: function testcase() {
+
+ function foo() { }
+ var obj = foo.bind({});
+ obj.property = 12;
+ return obj.hasOwnProperty("property");
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-1.js new file mode 100644 index 000000000..53233fd7a --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-1.js @@ -0,0 +1,51 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/*
+15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target is not callable.
+*/
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-2-1",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-1.js",
+
+description: "Function.prototype.bind throws TypeError if the Target is not callable (but an instance of Function)",
+
+test: function testcase() {
+ foo.prototype = Function.prototype;
+ // dummy function
+ function foo() {}
+ var f = new foo();
+
+ try {
+ f.bind();
+ }
+ catch (e) {
+ if (e instanceof TypeError) {
+ return true;
+ }
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-10.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-10.js new file mode 100644 index 000000000..bf20ad6b7 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-10.js @@ -0,0 +1,38 @@ +/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-2-10",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-10.js",
+
+ description: "Function.prototype.bind throws TypeError if 'Target' is undefined",
+
+ test: function testcase() {
+ try {
+ Function.prototype.bind.call(undefined);
+ return false;
+ } catch (e) {
+ return (e instanceof TypeError);
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
\ No newline at end of file diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-11.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-11.js new file mode 100644 index 000000000..a236a9efe --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-11.js @@ -0,0 +1,38 @@ +/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-2-11",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-11.js",
+
+ description: "Function.prototype.bind throws TypeError if 'Target' is NULL",
+
+ test: function testcase() {
+ try {
+ Function.prototype.bind.call(null);
+ return false;
+ } catch (e) {
+ return (e instanceof TypeError);
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
\ No newline at end of file diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-12.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-12.js new file mode 100644 index 000000000..513b7ef65 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-12.js @@ -0,0 +1,38 @@ +/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-2-12",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-12.js",
+
+ description: "Function.prototype.bind throws TypeError if 'Target' is a boolean",
+
+ test: function testcase() {
+ try {
+ Function.prototype.bind.call(true);
+ return false;
+ } catch (e) {
+ return (e instanceof TypeError);
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
\ No newline at end of file diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-13.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-13.js new file mode 100644 index 000000000..d40201de6 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-13.js @@ -0,0 +1,38 @@ +/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-2-13",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-13.js",
+
+ description: "Function.prototype.bind throws TypeError if 'Target' is a number",
+
+ test: function testcase() {
+ try {
+ Function.prototype.bind.call(5);
+ return false;
+ } catch (e) {
+ return (e instanceof TypeError);
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
\ No newline at end of file diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-14.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-14.js new file mode 100644 index 000000000..ad7716c3d --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-14.js @@ -0,0 +1,38 @@ +/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-2-14",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-14.js",
+
+ description: "Function.prototype.bind throws TypeError if 'Target' is a string",
+
+ test: function testcase() {
+ try {
+ Function.prototype.bind.call("abc");
+ return false;
+ } catch (e) {
+ return (e instanceof TypeError);
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
\ No newline at end of file diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-15.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-15.js new file mode 100644 index 000000000..841fe5e5b --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-15.js @@ -0,0 +1,38 @@ +/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-2-15",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-15.js",
+
+ description: "Function.prototype.bind throws TypeError if 'Target' is Object without Call internal method",
+
+ test: function testcase() {
+ try {
+ Function.prototype.bind.call({});
+ return false;
+ } catch (e) {
+ return (e instanceof TypeError);
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
\ No newline at end of file diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-16.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-16.js new file mode 100644 index 000000000..f4a5b4752 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-16.js @@ -0,0 +1,39 @@ +/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-2-16",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-16.js",
+
+ description: "Function.prototype.bind - 'Target' is a function",
+
+ test: function testcase() {
+ function testFunc() {}
+ try {
+ testFunc.bind();
+ return true;
+ } catch (e) {
+ return false;
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
\ No newline at end of file diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-2.js new file mode 100644 index 000000000..987d566ad --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-2.js @@ -0,0 +1,51 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/*
+15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target is not callable.
+*/
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-2-2",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-2.js",
+
+description: "Function.prototype.bind throws TypeError if the Target is not callable (bind attached to object)",
+
+test: function testcase() {
+ // dummy function
+ function foo() {}
+ var f = new foo();
+ f.bind = Function.prototype.bind;
+
+ try {
+ f.bind();
+ }
+ catch (e) {
+ if (e instanceof TypeError) {
+ return true;
+ }
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-3.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-3.js new file mode 100644 index 000000000..6f924d7b8 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-3.js @@ -0,0 +1,43 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/*
+15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target is not callable.
+*/
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-2-3",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-3.js",
+
+description: "Function.prototype.bind allows Target to be a constructor (Number)",
+
+test: function testcase() {
+ var bnc = Number.bind(null);
+ var n = bnc(42);
+ if (n === 42) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-4.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-4.js new file mode 100644 index 000000000..813c7fdd1 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-4.js @@ -0,0 +1,43 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/*
+15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target is not callable.
+*/
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-2-4",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-4.js",
+
+description: "Function.prototype.bind allows Target to be a constructor (String)",
+
+test: function testcase() {
+ var bsc = String.bind(null);
+ var s = bsc("hello world");
+ if (s === "hello world") {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-5.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-5.js new file mode 100644 index 000000000..467766721 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-5.js @@ -0,0 +1,43 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/*
+15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target is not callable.
+*/
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-2-5",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-5.js",
+
+description: "Function.prototype.bind allows Target to be a constructor (Boolean)",
+
+test: function testcase() {
+ var bbc = Boolean.bind(null);
+ var b = bbc(true);
+ if (b === true) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-6.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-6.js new file mode 100644 index 000000000..097dc860d --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-6.js @@ -0,0 +1,43 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/*
+15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target is not callable.
+*/
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-2-6",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-6.js",
+
+description: "Function.prototype.bind allows Target to be a constructor (Object)",
+
+test: function testcase() {
+ var boc = Object.bind(null);
+ var o = boc(42);
+ if (o == 42) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-7.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-7.js new file mode 100644 index 000000000..fbb108e5d --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-7.js @@ -0,0 +1,46 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/*
+15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target is not callable.
+*/
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-2-7",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-7.js",
+
+description: "Function.prototype.bind throws TypeError if the Target is not callable (JSON)",
+
+test: function testcase() {
+ try {
+ JSON.bind();
+ }
+ catch (e) {
+ if (e instanceof TypeError) {
+ return true;
+ }
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-8.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-8.js new file mode 100644 index 000000000..b1294ee3d --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-8.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+/*
+15.3.4.5 step 2 specifies that a TypeError must be thrown if the Target is not callable.
+*/
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-2-8",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-8.js",
+
+ description: "Function.prototype.bind allows Target to be a constructor (Array)",
+
+ test: function testcase() {
+ var bac = Array.bind(null);
+ var a = bac(42);
+ a.prop = "verifyPropertyExist";
+ a[41] = 41;
+
+ return a.prop === "verifyPropertyExist" && a[41] === 41 && a.length === 42;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-9.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-9.js new file mode 100644 index 000000000..4ac76eac1 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-9.js @@ -0,0 +1,40 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-2-9",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-2-9.js",
+
+description: "Function.prototype.bind allows Target to be a constructor (Date)",
+
+test: function testcase() {
+ var bdc = Date.bind(null);
+ var s = bdc(0, 0, 0);
+ if (typeof(s) === 'string') {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-1.js new file mode 100644 index 000000000..eff863057 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-1.js @@ -0,0 +1,39 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-20-1",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-1.js",
+
+ description: "Function.prototype.bind - 'caller' is defined as one property of 'F'",
+
+ test: function testcase() {
+
+ function foo() { }
+ var obj = foo.bind({});
+ return obj.hasOwnProperty("caller");
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-2.js new file mode 100644 index 000000000..e16f5a1a4 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-2.js @@ -0,0 +1,43 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-20-2",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-2.js",
+
+ description: "Function.prototype.bind - [[Get]] attribute of 'caller' property in 'F' is thrower",
+
+ test: function testcase() {
+
+ function foo() { }
+ var obj = foo.bind({});
+ try {
+ return obj.caller && false;
+ } catch (ex) {
+ return (ex instanceof TypeError);
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-3.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-3.js new file mode 100644 index 000000000..58cd13a20 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-3.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-20-3",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-3.js",
+
+ description: "Function.prototype.bind - [[Set]] attribute of 'caller' property in 'F' is thrower",
+
+ test: function testcase() {
+
+ function foo() { }
+ var obj = foo.bind({});
+ try {
+ obj.caller = 12;
+ return false;
+ } catch (ex) {
+ return (ex instanceof TypeError);
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-4.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-4.js new file mode 100644 index 000000000..29c4756f2 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-4.js @@ -0,0 +1,47 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-20-4",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-4.js",
+
+ description: "Function.prototype.bind - The [[Enumerable]] attribute of 'caller' property in 'F' is false",
+
+ test: function testcase() {
+
+ var canEnumerable = false;
+ var hasProperty = false;
+ function foo() { }
+ var obj = foo.bind({});
+ hasProperty = obj.hasOwnProperty("caller");
+ for (var prop in obj) {
+ if (prop === "caller") {
+ canEnumerable = true;
+ }
+ }
+ return hasProperty && !canEnumerable;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-5.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-5.js new file mode 100644 index 000000000..ad81acdc7 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-5.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-20-5",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-20-5.js",
+
+ description: "Function.prototype.bind - The [[Configurable]] attribute of 'caller' property in 'F' is false",
+
+ test: function testcase() {
+
+ var canConfigurable = false;
+ var hasProperty = false;
+ function foo() { }
+ var obj = foo.bind({});
+ hasProperty = obj.hasOwnProperty("caller");
+ delete obj.caller;
+ canConfigurable = obj.hasOwnProperty("caller");
+ return hasProperty && canConfigurable;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-1.js new file mode 100644 index 000000000..0c56348a0 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-1.js @@ -0,0 +1,39 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-21-1",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-1.js",
+
+ description: "Function.prototype.bind - 'arguments' is defined as one property of 'F'",
+
+ test: function testcase() {
+
+ function foo() { }
+ var obj = foo.bind({});
+ return obj.hasOwnProperty("arguments");
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-2.js new file mode 100644 index 000000000..9a78db661 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-2.js @@ -0,0 +1,43 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-21-2",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-2.js",
+
+ description: "Function.prototype.bind - [[Get]] attribute of 'arguments' property in 'F' is thrower",
+
+ test: function testcase() {
+
+ function foo() { }
+ var obj = foo.bind({});
+ try {
+ return obj.arguments && false;
+ } catch (ex) {
+ return (ex instanceof TypeError);
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-3.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-3.js new file mode 100644 index 000000000..f60e72402 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-3.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-21-3",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-3.js",
+
+ description: "Function.prototype.bind - [[Set]] attribute of 'arguments' property in 'F' is thrower",
+
+ test: function testcase() {
+
+ function foo() { }
+ var obj = foo.bind({});
+ try {
+ obj.arguments = 12;
+ return false;
+ } catch (ex) {
+ return (ex instanceof TypeError);
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-4.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-4.js new file mode 100644 index 000000000..2181677bd --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-4.js @@ -0,0 +1,47 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-21-4",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-4.js",
+
+ description: "Function.prototype.bind - The [[Enumerable]] attribute of 'arguments' property in 'F' is false",
+
+ test: function testcase() {
+
+ var canEnumerable = false;
+ var hasProperty = false;
+ function foo() { }
+ var obj = foo.bind({});
+ hasProperty = obj.hasOwnProperty("arguments");
+ for (var prop in obj) {
+ if (prop === "arguments") {
+ canEnumerable = true;
+ }
+ }
+ return hasProperty && !canEnumerable;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-5.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-5.js new file mode 100644 index 000000000..8c0f6a04a --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-5.js @@ -0,0 +1,44 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-21-5",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-21-5.js",
+
+ description: "Function.prototype.bind - The [[Configurable]] attribute of 'arguments' property in 'F' is false",
+
+ test: function testcase() {
+
+ var canConfigurable = false;
+ var hasProperty = false;
+ function foo() { }
+ var obj = foo.bind({});
+ hasProperty = obj.hasOwnProperty("arguments");
+ delete obj.caller;
+ canConfigurable = !obj.hasOwnProperty("arguments");
+ return hasProperty && !canConfigurable;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-3-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-3-1.js new file mode 100644 index 000000000..7af8252e9 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-3-1.js @@ -0,0 +1,43 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-3-1",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-3-1.js",
+
+ description: "Function.prototype.bind - each arg is defined in A in list order",
+
+ test: function testcase() {
+
+ var foo = function (x, y) {
+ return new Boolean((x + y) === "ab" && arguments[0] === "a" &&
+ arguments[1] === "b" && arguments.length === 2);
+ };
+
+ var obj = foo.bind({}, "a", "b");
+ return obj()==true;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-1.js new file mode 100644 index 000000000..ec33c66b5 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-1.js @@ -0,0 +1,41 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-1",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-1.js",
+
+ description: "Function.prototype.bind - F can get own data property",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ obj.property = 12;
+ return obj.property === 12;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-10.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-10.js new file mode 100644 index 000000000..84b6cf94d --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-10.js @@ -0,0 +1,54 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-10",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-10.js",
+
+ description: "Function.prototype.bind - F can get own accessor property without a get function that overrides an inherited accessor property",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ try {
+ Object.defineProperty(Function.prototype, "property", {
+ get: function () {
+ return 3;
+ },
+ configurable: true
+ });
+
+ Object.defineProperty(obj, "property", {
+ set: function () { }
+ });
+ return typeof (obj.property) === "undefined";
+ } finally {
+ delete Function.prototype.property;
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.defineProperty);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-11.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-11.js new file mode 100644 index 000000000..08f6d7fc2 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-11.js @@ -0,0 +1,48 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-11",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-11.js",
+
+ description: "Function.prototype.bind - F can get inherited accessor property without a get function",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ try {
+ Object.defineProperty(Function.prototype, "property", {
+ set: function () { },
+ configurable: true
+ });
+ return typeof (obj.property) === "undefined";
+ } finally {
+ delete Function.prototype.property;
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.defineProperty);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-12.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-12.js new file mode 100644 index 000000000..0707a88b3 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-12.js @@ -0,0 +1,40 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-12",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-12.js",
+
+ description: "Function.prototype.bind - F cannot get property which doesn't exist",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ return typeof (obj.property) === "undefined";
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-2.js new file mode 100644 index 000000000..e7820933a --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-2.js @@ -0,0 +1,45 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-2",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-2.js",
+
+ description: "Function.prototype.bind - F can get inherited data property",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ try {
+ Function.prototype.property = 12;
+ return obj.property === 12;
+ } finally {
+ delete Function.prototype.property;
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-3.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-3.js new file mode 100644 index 000000000..c572e7a84 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-3.js @@ -0,0 +1,47 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-3",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-3.js",
+
+ description: "Function.prototype.bind - F can get own data property that overrides an inherited data property",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+
+ try {
+ Function.prototype.property = 3;
+ obj.property = 12;
+ return obj.property === 12;
+ } finally {
+ delete Function.prototype.property;
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-4.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-4.js new file mode 100644 index 000000000..17f47a7fc --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-4.js @@ -0,0 +1,55 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-4",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-4.js",
+
+ description: "Function.prototype.bind - F can get own data property that overrides an inherited accessor property",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ try {
+ Object.defineProperty(Function.prototype, "property", {
+ get: function () {
+ return 3;
+ },
+ configurable: true
+ });
+
+ Object.defineProperty(obj, "property", {
+ value: 12
+ });
+
+ return obj.property === 12;
+ } finally {
+ delete Function.prototype.property;
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.defineProperty);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-5.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-5.js new file mode 100644 index 000000000..1d1fbc31d --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-5.js @@ -0,0 +1,45 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-5",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-5.js",
+
+ description: "Function.prototype.bind - F can get own accessor property",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ Object.defineProperty(obj, "property", {
+ get: function () {
+ return 12;
+ }
+ });
+ return obj.property === 12;
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.defineProperty);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-6.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-6.js new file mode 100644 index 000000000..c03e0c7a0 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-6.js @@ -0,0 +1,50 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-6",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-6.js",
+
+ description: "Function.prototype.bind - F can get inherited accessor property",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ try {
+ Object.defineProperty(Function.prototype, "property", {
+ get: function () {
+ return 12;
+ },
+ configurable: true
+ });
+ return obj.property === 12;
+ } finally {
+ delete Function.prototype.property;
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.defineProperty);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-7.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-7.js new file mode 100644 index 000000000..8eb6b7fed --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-7.js @@ -0,0 +1,50 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-7",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-7.js",
+
+ description: "Function.prototype.bind - F can get own accessor property that overrides an inherited data property",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ try {
+ Function.prototype.property = 3;
+ Object.defineProperty(obj, "property", {
+ get: function () {
+ return 12;
+ }
+ });
+ return obj.property === 12;
+ } finally {
+ delete Function.prototype.property;
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.defineProperty);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-8.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-8.js new file mode 100644 index 000000000..eb4e9e3cb --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-8.js @@ -0,0 +1,56 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-8",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-8.js",
+
+ description: "Function.prototype.bind - F can get own accessor property that overrides an inherited accessor property",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ try {
+ Object.defineProperty(Function.prototype, "property", {
+ get: function () {
+ return 3;
+ },
+ configurable: true
+ });
+
+ Object.defineProperty(obj, "property", {
+ get: function () {
+ return 12;
+ }
+ });
+ return obj.property === 12;
+ } finally {
+ delete Function.prototype.property;
+ }
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.defineProperty);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-9.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-9.js new file mode 100644 index 000000000..eb33d9093 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-9.js @@ -0,0 +1,43 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest({
+ id: "15.3.4.5-6-9",
+
+ path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-6-9.js",
+
+ description: "Function.prototype.bind - F can get own accessor property without a get function",
+
+ test: function testcase() {
+
+ var foo = function () { };
+
+ var obj = foo.bind({});
+ Object.defineProperty(obj, "property", {
+ set: function () {}
+ });
+ return obj.hasOwnProperty("property") && typeof (obj.property) === "undefined";
+ },
+
+ precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.defineProperty);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-8-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-8-1.js new file mode 100644 index 000000000..5593e8b19 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-8-1.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-8-1",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-8-1.js",
+
+description: "Function.prototype.bind, type of bound function must be 'function'",
+
+test: function testcase() {
+ function foo() { }
+ var o = {};
+
+ var bf = foo.bind(o);
+ if (typeof(bf) === 'function') {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-8-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-8-2.js new file mode 100644 index 000000000..805530450 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-8-2.js @@ -0,0 +1,43 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-8-2",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-8-2.js",
+
+description: "Function.prototype.bind, [[Class]] of bound function must be 'Function'",
+
+test: function testcase() {
+ function foo() { }
+ var o = {};
+
+ var bf = foo.bind(o);
+ var s = Object.prototype.toString.call(bf);
+ if (s === '[object Function]') {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-9-1.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-9-1.js new file mode 100644 index 000000000..62daec118 --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-9-1.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-9-1",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-9-1.js",
+
+description: "Function.prototype.bind, [[Prototype]] is Function.prototype",
+
+test: function testcase() {
+ function foo() { }
+ var o = {};
+
+ var bf = foo.bind(o);
+ if (Function.prototype.isPrototypeOf(bf)) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind);
+ }
+});
diff --git a/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-9-2.js b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-9-2.js new file mode 100644 index 000000000..5e85d51bf --- /dev/null +++ b/test/suite/ietestcenter/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-9-2.js @@ -0,0 +1,42 @@ +/// Copyright (c) 2009 Microsoft Corporation
+///
+/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
+/// that the following conditions are met:
+/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
+/// the following disclaimer.
+/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
+/// the following disclaimer in the documentation and/or other materials provided with the distribution.
+/// * Neither the name of Microsoft nor the names of its contributors may be used to
+/// endorse or promote products derived from this software without specific prior written permission.
+///
+/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
+/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+ES5Harness.registerTest( {
+id: "15.3.4.5-9-2",
+
+path: "TestCases/chapter15/15.3/15.3.4/15.3.4.5/15.3.4.5-9-2.js",
+
+description: "Function.prototype.bind, [[Prototype]] is Function.prototype (using getPrototypeOf)",
+
+test: function testcase() {
+ function foo() { }
+ var o = {};
+
+ var bf = foo.bind(o);
+ if (Object.getPrototypeOf(bf) === Function.prototype) {
+ return true;
+ }
+ },
+
+precondition: function prereq() {
+ return fnExists(Function.prototype.bind) && fnExists(Object.getPrototypeOf);
+ }
+});
|