On Tue, Oct 16, 2012 at 1:01 PM, James Foster <Smalltalk@jgfoster.net> wrote:
SUnit is just Smalltalk code and class variables are just objects. If you modify an object it is modified.
My approach to this problem is to modify the "singleton" pattern so that a class has both a "default" instance and a "current" instance. The #'current' method returns the current value if it is not nil, otherwise it returns the default value. The SUnit #'setUp' method sends a new instance as the argument to #'current:', and the #'tearDown' method sets current to nil. Most of you code asks for the current value; this will be the default or the test instance, depending on whether or not the tests are running.
this sounds handy.. i am going to have to write a few of these to make sure i get it.. -- ---- peace, sergio photographer, journalist, visionary http://www.ThoseOptimizeGuys.com http://www.CodingForHire.com http://www.coffee-black.com http://www.painlessfrugality.com http://www.twitter.com/sergio_101 http://www.facebook.com/sergio101