promises-aplus / promises-tests

Compliances tests for Promises/A+
Other
943 stars 107 forks source link

Contradiction between tests #33

Closed arieh closed 11 years ago

arieh commented 11 years ago

In test 3.2.6.2, in case of a rejection, exact value should be passed to the next rejection in chain, even if it is a thenable or a promise: https://github.com/promises-aplus/promises-tests/blob/master/lib/tests/3.2.6.js#L63-100

However, on tests 3.2.6.3.2 and 3.2.6.3.3, test require that incase the onReject returns a thenable, promise should try to chain itself to that promise. https://github.com/promises-aplus/promises-tests/blob/master/lib/tests/3.2.6.js#L157-272

Am I misunderstanding the tests?

This is the only thing blocking me from passing all tests

arieh commented 11 years ago

Another issue is that in case 3.2.6.3.2-3 are correct, there is a scenario where return thenable would fulfill, which would stop the rejection chain:

fulfilled_thenable = {then : function(f){ f(1);}};
promise1.then(null, function(){
   return fulfilled_thenable;
}).then(null, function(value){
  //will never reach here
});
briancavalier commented 11 years ago

@arieh, please also see my comments in your recent pull request #32. Promise rejections work much like synchronous catch. The existing tests and the intent of the spec are correct. In your example above, it is indeed correct that the "will never reach here" will, in fact, never be reached because the previous rejection handler successfully returned a fulfilled thenable, indicating that the rejection has been handled.

Have another read through section 3.2.6 of the spec, keeping in mind that promise rejections work like synchronous exceptions.

Closing, but please feel free to ask more questions here.