-
Notifications
You must be signed in to change notification settings - Fork 57
Whats wrong here? #1
Comments
That does look weird. But please provide a full, self-contained test to reproduce, and details about the version of gjstest and V8 that you are running. |
There is a bit syntactic sugar in there but I hope that is enough: events.js Events.method('fireLater', function (name, args) {
}); Events.method('on', function (name, func) {
}); events.test.js ...EventsTest.prototype.fireEventLaterWithArgs = function () {
}; |
A full and self-contained example, please. I'm looking one file that I can execute with |
Function.prototype.method = function (name, func) {
}; Function.method('inherits', function (superCtor) {
});
var Events = function () {
}; Events.method('fire', function (name, args) {
}); Events.method('fireLater', function (name, args) {
}); Events.method('on', function (name, func) {
}); Events.method('off', function (id) {
});
function EventsTest() {
} registerTestSuite(EventsTest); EventsTest.prototype.fireOneEvent = function () {
}; EventsTest.prototype.fireTwoEvents = function () {
}; EventsTest.prototype.fireOneEventWithParameters = function () {
}; EventsTest.prototype.fireTwoEventsWithParameters = function () {
}; EventsTest.prototype.fireEventLater = function () {
}; EventsTest.prototype.fireEventLaterWithArgs = function () {
}; EventsTest.prototype.unsubscribeEventHandler = function () {
}; gjstest --js_files=sugar.js,events.js,events.test.js google-js-test = latest |
Thanks. But there is a lot of JS magic there, and the way you have formatted your comment makes it exceedingly difficult to read. Please reduce this to a small test case—a single function on a single test suite that has no external dependencies, ideally. |
I tried narrowing this down, and it seems to come down to this line:
For the code in question, this causes So this is working as intended. |
That is the output from gjstest. It is a simple array concatenation like arr = [1,2,3].concat[4,5,6] given to a callback with apply(foo, arr) and tested with expectCall(...)(1, 2, 3, 4, 5, 6).
events.js:17: Call matches no expectation.
(No arguments.)
Tried expectation at events.test.js:77, but number of arguments didn't match:
Arg 0: 1
Arg 1: 2
Arg 2: 3
Arg 3: 4
Arg 4: 5
Arg 5: 6
Unsatisfied expectation at events.test.js:77:
Arg 0: 1
Arg 1: 2
Arg 2: 3
Arg 3: 4
Arg 4: 5
Arg 5: 6
Expected 1 call; called 0 times.
The text was updated successfully, but these errors were encountered: