1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/tests/ecma_5/extensions/15.4.4.11.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,32 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 + 1.6 +/* 1.7 + * Any copyright is dedicated to the Public Domain. 1.8 + * http://creativecommons.org/licenses/publicdomain/ 1.9 + */ 1.10 + 1.11 +function arr() { 1.12 + return Object.defineProperty([20, 10, 30], 0, {writable: false}); 1.13 +} 1.14 + 1.15 +assertEq(testLenientAndStrict('var a = arr(); a.sort()', 1.16 + raisesException(TypeError), 1.17 + raisesException(TypeError)), 1.18 + true); 1.19 + 1.20 +function obj() { 1.21 + var o = {0: 20, 1: 10, 2: 30, length: 3}; 1.22 + Object.defineProperty(o, 0, {writable: false}); 1.23 + return o; 1.24 +} 1.25 + 1.26 +assertEq(testLenientAndStrict('var o = obj(); Array.prototype.sort.call(o)', 1.27 + raisesException(TypeError), 1.28 + raisesException(TypeError)), 1.29 + true); 1.30 + 1.31 +// The behavior of sort is implementation-defined if the object being 1.32 +// sorted is sparse, so I'm not sure how to test its behavior on 1.33 +// non-configurable properties. 1.34 + 1.35 +reportCompare(true, true);