[squeak-dev] The Inbox: KernelTests-tonyg.381.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Jun 4 14:43:39 UTC 2020


A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-tonyg.381.mcz

==================== Summary ====================

Name: KernelTests-tonyg.381
Author: tonyg
Time: 4 June 2020, 4:43:38.797857 pm
UUID: 6d8f1efa-1e6e-470c-aa66-290bcb621a9f
Ancestors: KernelTests-mt.380

Tests for a discrepancy between current Promise implementation and the Promises/A+ spec. (Bug reported by Jakob Reschke on squeak-dev, 5 April 2020)

=============== Diff against KernelTests-mt.380 ===============

Item was added:
+ ----- Method: PromiseTest>>testAnErrorInOnRejectedRejectsPromise (in category 'tests - monad') -----
+ testAnErrorInOnRejectedRejectsPromise
+ 	"https://promisesaplus.com section 2.2.7.2"
+ 	| p q error |
+ 	p := Promise new.
+ 	q := p ifRejected: [:e | (error := KeyNotFound new) signal].
+ 	p rejectWith: 1.
+ 	self assert: p isRejected description: 'Original Promise not rejected'.
+ 	self assert: q isRejected description: 'Broken Promise not rejected'.
+ 	self assert: p error = 1.
+ 	self assert: q error == error.!

Item was changed:
  ----- Method: PromiseTest>>testAnErrorInThenRejectsPromise (in category 'tests - monad') -----
  testAnErrorInThenRejectsPromise
+ 	"https://promisesaplus.com section 2.2.7.2"
+ 	| p q error |
- 	| p q |
  	p := Promise new.
+ 	q := p then: [:v | (error := KeyNotFound new) signal].
- 	q := p then: [:v | KeyNotFound signal].
  	p resolveWith: 1.
  	self deny: p isRejected description: 'Original Promise rejected'.
+ 	self assert: q isRejected description: 'Broken Promise not rejected'.
+ 	self assert: p value = 1.
+ 	self assert: q error == error.!
- 	self assert: q isRejected description: 'Broken Promise not rejected'.!

Item was changed:
  ----- Method: PromiseTest>>testifRejectedRunsBlockIfPromiseFails (in category 'tests - monad') -----
  testifRejectedRunsBlockIfPromiseFails
+ 	"https://promisesaplus.com section 2.2.7.1"
  	| p q error |
  	error := nil.
  	p := Promise new.
+ 	q := p ifRejected: [:e | error := e "N.B. returns a value, does not signal an Exception"].
- 	q := p ifRejected: [:e | error := e].
  	p rejectWith: KeyNotFound new.
+ 	self assert: q isResolved.
+ 	self assert: KeyNotFound equals: error class.
+ 	self assert: q value == error.!
- 	self assert: q isRejected.
- 	self assert: KeyNotFound equals: error class.!



More information about the Squeak-dev mailing list