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

Unified Diff: test/mjsunit/logical.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/hex-parsing.js ('k') | test/mjsunit/multiline.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/logical.js
diff --git a/test/mjsunit/arguments.js b/test/mjsunit/logical.js
similarity index 50%
copy from test/mjsunit/arguments.js
copy to test/mjsunit/logical.js
index 030273904cc5d94e51eee75dc6a08b2a5a592719..23c53909f6ecdf0ab1c05b747e679159c3aee05e 100644
--- a/test/mjsunit/arguments.js
+++ b/test/mjsunit/logical.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,25 @@
// (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;
-}
-
-function argc1(i) {
- return arguments.length;
-}
-
-function argc2(i, j) {
- return arguments.length;
-}
-
-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));
-
-
-
-var index;
-
-function argv0() {
- return arguments[index];
-}
-
-function argv1(i) {
- return arguments[index];
-}
-
-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));
-
-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));
+var undef = void 0;
+
+assertEquals(1, 1 || 0);
+assertEquals(2, 0 || 2);
+assertEquals('foo', 0 || 'foo');
+assertEquals(undef, undef || undef);
+assertEquals('foo', 'foo' || 'bar');
+assertEquals('bar', undef || 'bar');
+assertEquals('bar', undef || 'bar' || 'baz');
+assertEquals('baz', undef || undef || 'baz');
+
+assertEquals(0, 1 && 0);
+assertEquals(0, 0 && 2);
+assertEquals(0, 0 && 'foo');
+assertEquals(undef, undef && undef);
+assertEquals('bar', 'foo' && 'bar');
+assertEquals(undef, undef && 'bar');
+assertEquals('baz', 'foo' && 'bar' && 'baz');
+assertEquals(undef, 'foo' && undef && 'baz');
+
+assertEquals(0, undef && undef || 0);
+assertEquals('bar', undef && 0 || 'bar');
« no previous file with comments | « test/mjsunit/hex-parsing.js ('k') | test/mjsunit/multiline.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698