Sorry I was rude.
I like your refactoring, it's cleaner than my code was, and creating the class is nice. Didn't understand default class and method name code. What would be a good example to use?
Daniel
"David T. Lewis" lewis@mail.msen.com wrote:
--Boundary_(ID_ZZbbHv6BpKgt6aGqeqChuw) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline
On Sun, Dec 23, 2001 at 12:23:14AM +0300, Daniel Vainsencher wrote:
"David T. Lewis" lewis@mail.msen.com wrote:
On Fri, Dec 21, 2001 at 10:27:08PM +0300, Daniel Vainsencher wrote: This is a very good idea, I like it.
Hey David. Thanks.
As long as it is OK to propose things that create work for other people, I have some suggestions ;)
Hey - no fair - you want to make suggestions, you're supposed to also cough up some helpful code :-) In the spirit of Goran's brave commitment (Go CSOTD!), give us a test, or implement at least one of the suggestions...
OK, you shamed me into it. Here is a CSOTD to add to TestMaker 0.2. It attempts to provide reasonable defaults for test class names and selectors. This implementation expects to see a class name as part of the expression being printed, which would be a typical case for an expression in a workspace, although not necessarily for an expression in a debugger pane.
Dave
--Boundary_(ID_ZZbbHv6BpKgt6aGqeqChuw) Content-type: application/x-gunzip; NAME=TestMaker-0-2-changes-dtl.cs.gz Content-transfer-encoding: base64 Content-disposition: attachment; filename=TestMaker-0-2-changes-dtl.cs.gz
H4sICPdGJjwAA1Rlc3RNYWtlci0wLTItY2hhbmdlcy1kdGwuY3MArVhbb9tGFn7mA//D2F5A FGCrsuQkWC7chWvHQLFJXNRq98FQgBE5sqamhupwZFkL//h+Z4aXISUlKLyBgZCccz/fuYx6 tzpfsvs/14I/jQfnPFstOMvnbPSB3YuVEcuZ0Gw0HJ6zh4wbURi2XqV4iNnJxfjiw5Tlio3G 7EYkHik37CIeXcTjD2y17B2Fx9cLrh4FJJo4CCaQ8pk/CX02PBudKbFxp8VZarLwhmQHQdCV GV6tzSLXdHTDn2XKJgP2SWxkEYaThSwY/ji7vr+b3DCTs5lgPE1FSs+1OjYcjMLwZwPz4NfK FHS60jmkCaYFL3LFZ5lgqZjzdY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KHHm/Nqvf7rRfD1PaHJGWavaU1s+Z0NrdTAFvQeDAlslWOS6Us2xLP1ya BceVlast843DBaVu2S61fm61yPUjV9jJjsLowKW3/VOdf4vde9/1CPqQWQOmvSfZi83+W8XB df6bK+/3NsHdbt7p4B3EtoHaDxG4shlgK8mfPWij8Sei5clR+Bd6Axl4HhcAAA==
--Boundary_(ID_ZZbbHv6BpKgt6aGqeqChuw)--
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
squeak-dev@lists.squeakfoundation.org