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

Unified Diff: test/mjsunit/harmony/object-observe.js

Issue 11369150: Add more test coverage for setting Array.length (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/object-observe.js
diff --git a/test/mjsunit/harmony/object-observe.js b/test/mjsunit/harmony/object-observe.js
index 231fe91e18594797c5519eec6fbc9f2b839998ef..d8395b99e8c869c73f1ed1746e9a7ec76f44b985 100644
--- a/test/mjsunit/harmony/object-observe.js
+++ b/test/mjsunit/harmony/object-observe.js
@@ -338,6 +338,8 @@ reset();
var arr = ['a', 'b', 'c', 'd'];
var arr2 = ['alpha', 'beta'];
var arr3 = ['hello'];
+arr3[2] = 'goodbye';
+arr3.length = 6;
// TODO(adamk): Enable this test case when it can run in a reasonable
// amount of time.
//var slow_arr = new Array(1000000000);
@@ -354,7 +356,10 @@ arr.length = 10;
arr2.length = 0;
arr2.length = 1; // no change expected
arr3.length = 0;
+Object.defineProperty(arr3, 'length', {value: 5});
+Object.defineProperty(arr3, 'length', {value: 10, writable: false});
Object.deliverChangeRecords(observer.callback);
+observer.records.forEach(function(r){print(JSON.stringify(r))});
observer.assertCallbackRecords([
{ object: arr, name: '3', type: 'deleted', oldValue: 'd' },
// TODO(adamk): oldValue should not be present below
@@ -365,8 +370,13 @@ observer.assertCallbackRecords([
{ object: arr, name: 'length', type: 'updated', oldValue: 1 },
{ object: arr2, name: '1', type: 'deleted', oldValue: 'beta' },
{ object: arr2, name: 'length', type: 'updated', oldValue: 2 },
+ { object: arr3, name: '2', type: 'deleted', oldValue: 'goodbye' },
{ object: arr3, name: '0', type: 'deleted', oldValue: 'hello' },
- { object: arr3, name: 'length', type: 'updated', oldValue: 1 },
+ { object: arr3, name: 'length', type: 'updated', oldValue: 6 },
+ { object: arr3, name: 'length', type: 'updated', oldValue: 0 },
+ { object: arr3, name: 'length', type: 'updated', oldValue: 5 },
+ // TODO(adamk): This record should be merged with the above
+ { object: arr3, name: 'length', type: 'reconfigured' },
]);
// Assignments in loops (checking different IC states).
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698