Skip to content

Commit 289e52c

Browse files
committed
test: trace NSMutableArray JS dispatch
1 parent 197577e commit 289e52c

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

test/runtime/runner/app/tests/ApiTests.js

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,13 @@ describe(module.id, function () {
247247
});
248248

249249
it("NSMutableArrayMethods", function () {
250+
console.log("NS_MUTARRAY_JS spec enter");
250251
var JSMutableArray = NSMutableArray.extend({
251252
init: function () {
253+
console.log("NS_MUTARRAY_JS init enter");
252254
var self = NSMutableArray.prototype.init.apply(this, arguments);
253255
self._array = [];
256+
console.log("NS_MUTARRAY_JS init exit");
254257
return self;
255258
},
256259
// TODO
@@ -260,38 +263,60 @@ describe(module.id, function () {
260263
// NSMutableArray.prototype.dealloc.apply(this, arguments);
261264
// },
262265
insertObjectAtIndex: function (anObject, index) {
266+
console.log("NS_MUTARRAY_JS insertObjectAtIndex enter", anObject, index);
263267
this._array.splice(index, 0, anObject);
268+
console.log("NS_MUTARRAY_JS insertObjectAtIndex exit", this._array.length);
264269
},
265270
removeObjectAtIndex: function (index) {
271+
console.log("NS_MUTARRAY_JS removeObjectAtIndex enter", index);
266272
this._array.splice(index, 1);
273+
console.log("NS_MUTARRAY_JS removeObjectAtIndex exit", this._array.length);
267274
},
268275
addObject: function (anObject) {
276+
console.log("NS_MUTARRAY_JS addObject enter", anObject);
269277
this._array.push(anObject);
278+
console.log("NS_MUTARRAY_JS addObject exit", this._array.length);
270279
},
271280
removeLastObject: function () {
281+
console.log("NS_MUTARRAY_JS removeLastObject enter");
272282
this._array.pop();
283+
console.log("NS_MUTARRAY_JS removeLastObject exit", this._array.length);
273284
},
274285
replaceObjectAtIndexWithObject: function (index, anObject) {
286+
console.log("NS_MUTARRAY_JS replaceObjectAtIndexWithObject enter", index, anObject);
275287
this._array[index] = anObject;
288+
console.log("NS_MUTARRAY_JS replaceObjectAtIndexWithObject exit", this._array.length);
276289
},
277290
objectAtIndex: function (index) {
278-
return this._array[index];
291+
var value = this._array[index];
292+
console.log("NS_MUTARRAY_JS objectAtIndex", index, value);
293+
return value;
279294
},
280295
get count() {
281-
return this._array.length;
296+
var count = this._array.length;
297+
console.log("NS_MUTARRAY_JS count", count);
298+
return count;
282299
},
283300
get hash() {
284-
return this.count;
301+
var hash = this.count;
302+
console.log("NS_MUTARRAY_JS hash", hash);
303+
return hash;
285304
}
286305
}, {
287306
name: 'JSMutableArray'
288307
});
308+
console.log("NS_MUTARRAY_JS class ready");
289309

290310
(function () {
311+
console.log("NS_MUTARRAY_JS before new");
291312
var array = new JSMutableArray();
313+
console.log("NS_MUTARRAY_JS after new");
314+
console.log("NS_MUTARRAY_JS before native");
292315
TNSTestNativeCallbacks.apiNSMutableArrayMethods(array);
316+
console.log("NS_MUTARRAY_JS after native");
293317
}());
294318
gc();
319+
console.log("NS_MUTARRAY_JS after gc");
295320

296321
expect(TNSGetOutput()).toBe('44abcd');
297322
});

0 commit comments

Comments
 (0)