Commit 41427a30 authored by arv@chromium.org's avatar arv@chromium.org

Remove duplicate property test

In ES6, these are now allowed in both strict and sloppy mode.

These tests will fail when v8:3498 lands and gets rolled.

BUG=403353
R=dpranke@chromium.org

Review URL: https://codereview.chromium.org/467903003

git-svn-id: svn://svn.chromium.org/blink/trunk@180197 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent c90d857a
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../resources/moz-test-style.css">
<script src="../resources/moz-test-pre.js"></script>
<script src="../resources/mozilla-shell.js"></script>
<script src="../resources/mozilla-es5-shell.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="script-tests/11.1.5.js"></script>
<script src="../resources/moz-test-post.js"></script>
</body>
</html>
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/licenses/publicdomain/
*/
/* Simple identifier labels. */
assertEq(testLenientAndStrict('({x:1, x:1})',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({x:1, y:1})',
parsesSuccessfully,
parsesSuccessfully),
true);
assertEq(testLenientAndStrict('({x:1, y:1, x:1})',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
/* Property names can be written as strings, too. */
assertEq(testLenientAndStrict('({x:1, "x":1})',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({"x":1, x:1})',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({"x":1, "x":1})',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
/* Numeric property names. */
assertEq(testLenientAndStrict('({1.5:1, 1.5:1})',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({1.5:1, 15e-1:1})',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({6.02214179e23:1, 6.02214179e23:1})',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({6.02214179e23:1, 3.1415926535:1})',
parsesSuccessfully,
parsesSuccessfully),
true);
assertEq(testLenientAndStrict('({ 1: 1, "1": 2 })',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({ "1": 1, 1: 2 })',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({ 2.5: 1, "2.5": 2 })',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({ "2.5": 1, 2.5: 2 })',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
/* Many properties, to exercise JSAtomList's hash-table variant. */
assertEq(testLenientAndStrict('({a:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1, i:1, j:1, k:1, l:1, m:1, n:1, o:1, p:1, q:1, r:1, s:1, t:1, u:1, v:1, w:1, x:1, y:1, z:1})',
parsesSuccessfully,
parsesSuccessfully),
true);
assertEq(testLenientAndStrict('({a:1, b:1, c:1, d:1, e:1, f:1, g:1, h:1, i:1, j:1, k:1, l:1, m:1, n:1, o:1, p:1, q:1, r:1, s:1, t:1, u:1, v:1, w:1, x:1, y:1, a:1})',
parsesSuccessfully,
parseRaisesException(SyntaxError)),
true);
/*
* Getters, setters, and value properties should conflict only when
* appropriate.
*/
assertEq(testLenientAndStrict('({get x() {}, x:1})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({x:1, get x() {}})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({set x(q) {}, x:1})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({x:1, set x(q) {}})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({1:1, set 1(q) {}})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({set 1(q) {}, 1:1})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({"1":1, set 1(q) {}})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({set 1(q) {}, "1":1})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({get x() {}, set x(q) {}})',
parsesSuccessfully,
parsesSuccessfully),
true);
assertEq(testLenientAndStrict('({set x(q) {}, get x() {}})',
parsesSuccessfully,
parsesSuccessfully),
true);
assertEq(testLenientAndStrict('({get x() {}, set x(q) {}, x:1})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({set x(q) {}, get x() {}, x:1})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({get x() {}, get x() {}})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({set x() {}, set x() {}})',
parseRaisesException(SyntaxError),
parseRaisesException(SyntaxError)),
true);
assertEq(testLenientAndStrict('({get x() {}, set x(q) {}, y:1})',
parsesSuccessfully,
parsesSuccessfully),
true);
reportCompare(true, true);
var successfullyParsed = true;
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/ie-test-pre.js"></script>
<script src="TestCases/11.1.5_4-4-b-1.js"></script>
<script src="resources/ie-test-post.js"></script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/ie-test-pre.js"></script>
<script src="TestCases/11.1.5_4-4-b-2.js"></script>
<script src="resources/ie-test-post.js"></script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/ie-test-pre.js"></script>
<script src="TestCases/11.1.5_4-4-c-1.js"></script>
<script src="resources/ie-test-post.js"></script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/ie-test-pre.js"></script>
<script src="TestCases/11.1.5_4-4-c-2.js"></script>
<script src="resources/ie-test-post.js"></script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/ie-test-pre.js"></script>
<script src="TestCases/11.1.5_4-4-d-1.js"></script>
<script src="resources/ie-test-post.js"></script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/ie-test-pre.js"></script>
<script src="TestCases/11.1.5_4-4-d-2.js"></script>
<script src="resources/ie-test-post.js"></script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/ie-test-pre.js"></script>
<script src="TestCases/11.1.5_4-4-d-3.js"></script>
<script src="resources/ie-test-post.js"></script>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script src="resources/ie-test-pre.js"></script>
<script src="TestCases/11.1.5_4-4-d-4.js"></script>
<script src="resources/ie-test-post.js"></script>
</body>
</html>
/// 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.
/*
Refer 11.1.5;
The production
PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true.
*/
ES5Harness.registerTest( {
id: "11.1.5_4-4-b-1",
path: "TestCases/chapter11/11.1/11.1.5/11.1.5_4-4-b-1.js",
description: "Object literal - SyntaxError if a data property definition is followed by get accessor definition with the same name",
test: function testcase() {
try
{
eval("({foo : 1, get foo(){}});");
}
catch(e)
{
if(e instanceof SyntaxError)
return true;
}
},
precondition: function () {
//accessor properties in object literals must be allowed
try {eval("({set foo(x) {}, get foo(){}});");}
catch(e) {return false}
return true;
}
});
/// 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.
/*
Refer 11.1.5;
The production
PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
b.IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true.
*/
ES5Harness.registerTest( {
id: "11.1.5_4-4-b-2",
path: "TestCases/chapter11/11.1/11.1.5/11.1.5_4-4-b-2.js",
description: "Object literal - SyntaxError if a data property definition is followed by set accessor definition with the same name",
test: function testcase() {
try
{
eval("({foo : 1, set foo(x){}});");
}
catch(e)
{
if(e instanceof SyntaxError)
return true;
}
},
precondition: function () {
//accessor properties in object literals must be allowed
try {eval("({set foo(x) {}, get foo(){}});");}
catch(e) {return false}
return true;
}
});
/// 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.
/*
Refer 11.1.5;
The production
PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
*/
ES5Harness.registerTest( {
id: "11.1.5_4-4-c-1",
path: "TestCases/chapter11/11.1/11.1.5/11.1.5_4-4-c-1.js",
description: "Object literal - SyntaxError if a get accessor property definition is followed by a data property definition with the same name",
test: function testcase() {
try
{
eval("({get foo(){}, foo : 1});");
}
catch(e)
{
if(e instanceof SyntaxError)
return true;
}
},
precondition: function () {
//accessor properties in object literals must be allowed
try {eval("({set foo(x) {}, get foo(){}});");}
catch(e) {return false}
return true;
}
});
/// 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.
/*
Refer 11.1.5;
The production
PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
*/
ES5Harness.registerTest( {
id: "11.1.5_4-4-c-2",
path: "TestCases/chapter11/11.1/11.1.5/11.1.5_4-4-c-2.js",
description: "Object literal - SyntaxError if a set accessor property definition is followed by a data property definition with the same name",
test: function testcase() {
try
{
eval("({set foo(x){}, foo : 1});");
}
catch(e)
{
if(e instanceof SyntaxError)
return true;
}
},
precondition: function () {
//accessor properties in object literals must be allowed
try {eval("({set foo(x) {}, get foo(){}});");}
catch(e) {return false};
return true;
}
});
/// 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.
/*
Refer 11.1.5;
The production
PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
d. IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true and either both previous and propId.descriptor have [[Get]] fields or both previous and propId.descriptor have [[Set]] fields
*/
ES5Harness.registerTest( {
id: "11.1.5_4-4-d-1",
path: "TestCases/chapter11/11.1/11.1.5/11.1.5_4-4-d-1.js",
description: "Object literal - SyntaxError for duplicate property name (get,get)",
test: function testcase() {
try
{
eval("({get foo(){}, get foo(){}});");
}
catch(e)
{
if(e instanceof SyntaxError)
return true;
}
},
precondition: function () {
//accessor properties in object literals must be allowed
try {eval("({set foo(x) {}, get foo(){}});");}
catch(e) {return false}
return true;
}
});
/// 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.
/*
Refer 11.1.5;
The production
PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
d. IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true and either both previous and propId.descriptor have [[Get]] fields or both previous and propId.descriptor have [[Set]] fields
*/
ES5Harness.registerTest( {
id: "11.1.5_4-4-d-2",
path: "TestCases/chapter11/11.1/11.1.5/11.1.5_4-4-d-2.js",
description: "Object literal - SyntaxError for duplicate property name (set,set)",
test: function testcase() {
try
{
eval("({set foo(arg){}, set foo(arg1){}});");
}
catch(e)
{
if(e instanceof SyntaxError)
return true;
}
},
precondition: function () {
//accessor properties in object literals must be allowed
try {eval("({set foo(x) {}, get foo(){}});");}
catch(e) {return false}
return true;
}
});
/// 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.
/*
Refer 11.1.5;
The production
PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
d. IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true and either both previous and propId.descriptor have [[Get]] fields or both previous and propId.descriptor have [[Set]] fields
*/
ES5Harness.registerTest( {
id: "11.1.5_4-4-d-3",
path: "TestCases/chapter11/11.1/11.1.5/11.1.5_4-4-d-3.js",
description: "Object literal - SyntaxError for duplicate property name (get,set,get)",
test: function testcase() {
try
{
eval("({get foo(){}, set foo(arg){}, get foo(){}});");
}
catch(e)
{
if(e instanceof SyntaxError)
return true;
}
},
precondition: function () {
//accessor properties in object literals must be allowed
try {eval("({set foo(x) {}, get foo(){}});");}
catch(e) {return false}
return true;
}
});
/// 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.
/*
Refer 11.1.5;
The production
PropertyNameAndValueList : PropertyNameAndValueList , PropertyAssignment
4. If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
d. IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true and either both previous and propId.descriptor have [[Get]] fields or both previous and propId.descriptor have [[Set]] fields
*/
ES5Harness.registerTest( {
id: "11.1.5_4-4-d-4",
path: "TestCases/chapter11/11.1/11.1.5/11.1.5_4-4-d-4.js",
description: "Object literal - SyntaxError for duplicate property name (set,get,set)",
test: function testcase() {
try
{
eval("({set foo(arg){}, get foo(){}, set foo(arg1){}});");
}
catch(e)
{
if(e instanceof SyntaxError)
return true;
}
},
precondition: function () {
//accessor properties in object literals must be allowed
try {eval("({set foo(x) {}, get foo(){}});");}
catch(e) {return false}
return true;
}
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment