On Thu, Jan 19, 2017 at 06:46:22PM +0100, Stephane Ducasse wrote:
> I would love to get a functionality that dynamically removes from my code
> all the self halt that are encountered during test execution.
> This way I will not need to run the test, walk the stack, edit the code and
> retart the process.
> It would be really cool
You mean to _permanently_ remove them after the test passed, or just temporarily disable them during the execution?
The latter can be done with MetaLinks, e.g.:
Something>>add: aNumber to: anotherNumber
^ anotherNumber + aNumber
self assert: (Something new add: 4 to: 10) equals: 14
| halts |
halts := (Something >> #add:to:) ast sendNodes select: [ :each | each selector = #halt ].
link := MetaLink new control: #instead.
halts do: [ :each | each link: link ].
Now if I call the method by hand it will halt, but the test will skip the halts.