How about this: -- takes a string and does a global replacement on substrings.. gsub: aString "from email correspondence with Nicolas Cellier " | newString | newString:= self parameters associations inject: aString into: [:subst :assoc | assoc key asRegex copy: subst replacingMatchesWith: assoc value]. ^newString testBasicGsub | string result| "aDict at: 'test' put: 'testreplaced'; at: 'hello' put: 'hello'; at: 'hello2' put: 'hello2replaced'." string:='test'. result:= FiconabGsub replace: string using: aDict. self assert: result='testreplaced'. string:='test test'. result:= FiconabGsub replace: string using: aDict. self assert: result='testreplaced testreplaced'. S. On 13 Oct, 2012, at 10:47 PM, Damien Cassou <damien.cassou@gmail.com> wrote:
I'm looking for a piece of code that is hard to understand by looking at the source code but which has unit tests that help understanding the behavior.
Do you have any idea?
-- Damien Cassou http://damiencassou.seasidehosting.st
"Success is the ability to go from one failure to another without losing enthusiasm." Winston Churchill