On Sat, Dec 29, 2001 at 06:28:47PM +0300, danielv@netvision.net.il wrote:
Sorry I was rude.
Just joking, it's OK!
Didn't understand default class and method name code. What would be a good example to use?
For example, if you do a printIt on the following expression: "(Array with: '5@6' with: 'Set new') evalStrings first class == Point"
The TestMaker will deduce that you want to test the method #evalStrings in class Array. Based on this, it will prompt to ask if you want to create the method #testEvalStrings and put it in class ArrayTestCase.
It does this by using a Scanner to parse the expression into a tree of Smalltalk tokens, then flattening the tree into a list of tokens. It looks for the first element in the list which is a class name (#Array in this example). It then takes the remainder of the list and looks for the longest combination of tokens which can be combined to form a selector in class Array (#evalStrings in this example).
As another example, "((Dictionary new at: #foo put: #bar; yourself) at: #foo) == #bar" results in test method #testAtPut and class DictionaryTestCase, while the expression "Dictionary new at: #foo" results in test method #testAt in class DictionaryTestCast.
There are lots of expressions for which this will not work, but perhaps it is at least a start. At least it was a CSOTD ;)
Meanwhile I found a bug in the code which caused it to fail for expressions like "(Array new: 3) size == 3" which contain integer tokens. A fix is attached.
Dave