| Index: test/webkit/fast/js/kde/arguments-scope.js
|
| diff --git a/test/webkit/sort-large-array.js b/test/webkit/fast/js/kde/arguments-scope.js
|
| similarity index 55%
|
| copy from test/webkit/sort-large-array.js
|
| copy to test/webkit/fast/js/kde/arguments-scope.js
|
| index 43eed3ff16488b50eec815905801bad0cbee8afa..cef3698b5e929edfb5587918ab3553aca9e78165 100644
|
| --- a/test/webkit/sort-large-array.js
|
| +++ b/test/webkit/fast/js/kde/arguments-scope.js
|
| @@ -21,23 +21,53 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -description("This tests sorting an array with more than 10,000 values.");
|
| -
|
| -var test = [];
|
| -for (var i = 0; i < 10010; i++)
|
| - test.push(10009 - i);
|
| -test.sort(function(a, b) {return a - b;});
|
| -
|
| -shouldBe("test.length", "10010");
|
| -shouldBe("test[9999]", "9999");
|
| -shouldBe("test[10000]", "10000");
|
| -shouldBe("test.slice(0, 20).join(', ')", "'0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19'");
|
| -shouldBe("test.slice(9990, 10010).join(', ')", "'9990, 9991, 9992, 9993, 9994, 9995, 9996, 9997, 9998, 9999, 10000, 10001, 10002, 10003, 10004, 10005, 10006, 10007, 10008, 10009'");
|
| -
|
| -var testNoValues = [];
|
| -testNoValues.length = 10110;
|
| -testNoValues.sort(function(a, b) {return a < b;});
|
| -
|
| -shouldBe("testNoValues.length", "10110");
|
| -shouldBe("testNoValues[9999]", "undefined");
|
| -shouldBe("testNoValues[10000]", "undefined");
|
| +description("KDE JS Test");
|
| +// We can't use normal shouldBe here, since they'd eval in the wrong context...
|
| +
|
| +function shouldBeOfType(msg, val, type) {
|
| + if (typeof(val) != type)
|
| + testFailed(msg + ": value has type " + typeof(val) + " , not:" + type);
|
| + else
|
| + testPassed(msg);
|
| +}
|
| +
|
| +function test0() {
|
| + var arguments;
|
| + // var execution should not overwrite something that was
|
| + // in scope beforehand -- e.g. the arguments thing
|
| + shouldBeOfType("test0", arguments, 'object');
|
| + }
|
| +
|
| +function test1() {
|
| + // No need to undef-initialize something in scope already!
|
| + shouldBeOfType("test1", arguments, 'object');
|
| + var arguments;
|
| +}
|
| +
|
| +function test2(arguments) {
|
| + // Formals OTOH can overwrite the args object
|
| + shouldBeOfType("test2", arguments, 'number');
|
| +}
|
| +
|
| +
|
| +function test3() {
|
| + // Ditto for functions..
|
| + shouldBeOfType("test3", arguments, 'function');
|
| + function arguments() {}
|
| +}
|
| +
|
| +function test4() {
|
| + // Here, the -declaration- part of the var below should have no
|
| + // effect..
|
| + shouldBeOfType('test4.(1)', arguments, 'object');
|
| + var arguments = 4;
|
| + // .. but the assignment shoud just happen
|
| + shouldBeOfType('test4.(2)', arguments, 'number');
|
| +}
|
| +
|
| +
|
| +test0();
|
| +test1();
|
| +test2(42);
|
| +test3();
|
| +test4();
|
|
|