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

Unified Diff: test/mjsunit/boolean.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/arguments-escape.js ('k') | test/mjsunit/break.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/boolean.js
diff --git a/test/mjsunit/arguments.js b/test/mjsunit/boolean.js
similarity index 50%
copy from test/mjsunit/arguments.js
copy to test/mjsunit/boolean.js
index 030273904cc5d94e51eee75dc6a08b2a5a592719..d955855d3aa6a610f1ded3a09a195372015305ec 100644
--- a/test/mjsunit/arguments.js
+++ b/test/mjsunit/boolean.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,50 @@
// (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;
-}
+assertEquals(Boolean(void 0), false);
+assertEquals(Boolean(null), false);
+assertEquals(Boolean(false), false);
+assertEquals(Boolean(true), true);
+assertEquals(Boolean(0), false);
+assertEquals(Boolean(1), true);
+assertEquals(Boolean(assertEquals), true);
+assertEquals(Boolean(new Object()), true);
+assertTrue(new Boolean(false) !== false);
+assertTrue(new Boolean(false) == false);
+assertTrue(new Boolean(true) !== true);
+assertTrue(new Boolean(true) == true);
-function argc1(i) {
- return arguments.length;
-}
+assertEquals(true, !false);
+assertEquals(false, !true);
+assertEquals(true, !!true);
+assertEquals(false, !!false);
-function argc2(i, j) {
- return arguments.length;
-}
+assertEquals(true, true ? true : false);
+assertEquals(false, false ? true : false);
-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));
+assertEquals(false, true ? false : true);
+assertEquals(true, false ? false : true);
+assertEquals(true, true && true);
+assertEquals(false, true && false);
+assertEquals(false, false && true);
+assertEquals(false, false && false);
-var index;
+// Regression.
+var t = 42;
+assertEquals(void 0, t.p);
+assertEquals(void 0, t.p && true);
+assertEquals(void 0, t.p && false);
+assertEquals(void 0, t.p && (t.p == 0));
+assertEquals(void 0, t.p && (t.p == null));
+assertEquals(void 0, t.p && (t.p == t.p));
-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 o = new Object();
+o.p = 'foo';
+assertEquals('foo', o.p);
+assertEquals('foo', o.p || true);
+assertEquals('foo', o.p || false);
+assertEquals('foo', o.p || (o.p == 0));
+assertEquals('foo', o.p || (o.p == null));
+assertEquals('foo', o.p || (o.p == o.p));
« no previous file with comments | « test/mjsunit/arguments-escape.js ('k') | test/mjsunit/break.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698