Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1283)

Unified Diff: test/mjsunit/argument-named-arguments.js

Issue 7171016: Add a number of old tests to the mjsunit test suite. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/argument-assigned.js ('k') | test/mjsunit/arguments.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/argument-named-arguments.js
diff --git a/test/mjsunit/arguments.js b/test/mjsunit/argument-named-arguments.js
similarity index 50%
copy from test/mjsunit/arguments.js
copy to test/mjsunit/argument-named-arguments.js
index 030273904cc5d94e51eee75dc6a08b2a5a592719..2845102b7c96feee353aab6058e5d74756c28ef9 100644
--- a/test/mjsunit/arguments.js
+++ b/test/mjsunit/argument-named-arguments.js
@@ -1,4 +1,4 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -25,73 +25,43 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-function argc0() {
- return arguments.length;
-}
+// Tests to verify proper arguments handling if the arguments
+// variable is declared as a parameter or local variable.
-function argc1(i) {
- return arguments.length;
-}
+function e(a) {
+ assertEquals(9, a.length);
+ assertEquals("arguments", a);
+};
-function argc2(i, j) {
- return arguments.length;
-}
+e("arguments");
-assertEquals(0, argc0());
-assertEquals(1, argc0(1));
-assertEquals(2, argc0(1, 2));
-assertEquals(3, argc0(1, 2, 3));
-assertEquals(0, argc1());
-assertEquals(1, argc1(1));
-assertEquals(2, argc1(1, 2));
-assertEquals(3, argc1(1, 2, 3));
-assertEquals(0, argc2());
-assertEquals(1, argc2(1));
-assertEquals(2, argc2(1, 2));
-assertEquals(3, argc2(1, 2, 3));
+function f(arguments) {
+ assertEquals(9, arguments.length);
+ assertEquals("arguments", arguments);
+};
+f("arguments");
-var index;
-function argv0() {
- return arguments[index];
-}
+function g(x) {
+ var arguments;
+ assertEquals("arguments", x);
+ assertEquals(1, arguments.length);
+ assertEquals("[object Arguments]", '' + arguments);
+};
-function argv1(i) {
- return arguments[index];
-}
+g("arguments");
-function argv2(i, j) {
- return arguments[index];
-}
-index = 0;
-assertEquals(7, argv0(7));
-assertEquals(7, argv0(7, 8));
-assertEquals(7, argv0(7, 8, 9));
-assertEquals(7, argv1(7));
-assertEquals(7, argv1(7, 8));
-assertEquals(7, argv1(7, 8, 9));
-assertEquals(7, argv2(7));
-assertEquals(7, argv2(7, 8));
-assertEquals(7, argv2(7, 8, 9));
+function h(x) {
+ assertEquals("arguments", x);
+ assertEquals(1, arguments.length);
+ assertEquals("[object Arguments]", '' + arguments);
+ var arguments = "foobar";
+ assertEquals("arguments", x);
+ assertEquals(6, arguments.length);
+ assertEquals("foobar", '' + arguments);
+};
-index = 1;
-assertEquals(8, argv0(7, 8));
-assertEquals(8, argv0(7, 8));
-assertEquals(8, argv1(7, 8, 9));
-assertEquals(8, argv1(7, 8, 9));
-assertEquals(8, argv2(7, 8, 9));
-assertEquals(8, argv2(7, 8, 9));
-
-index = 2;
-assertEquals(9, argv0(7, 8, 9));
-assertEquals(9, argv1(7, 8, 9));
-assertEquals(9, argv2(7, 8, 9));
-
-
-// Test that calling a lazily compiled function with
-// an unexpected number of arguments works.
-function f(a) { return arguments.length; };
-assertEquals(3, f(1, 2, 3));
+h("arguments");
« no previous file with comments | « test/mjsunit/argument-assigned.js ('k') | test/mjsunit/arguments.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698