[Pharo-project] Method Wrappers and the Debugger
I'm writing a test double library similar to Ruby's rspec. The first signs of life can be downloaded via: Gofer new squeaksource: 'BDDExtensions'; package: 'Mock'; load. One of the features is to partially stub a class, so one could have e.g. DateAndTime>>#now return a canned value. It's easy enough to implement, but the wheels fall off in the debugger, where the VM quits and leaves no log on the last line of the following snippet. In a workspace, I just get a DNU, described in the comment: startTime := DateAndTime now. DateAndTime stub: #now andReturn: startTime. "DoIt this last line... works great. Debug this last line... DateAndTime class(Object)>>doesNotUnderstand: 224@116. It originally ran into Object>>at: error not indexable until I implemented at: and forwarded it to the original CompiledMethod" DateAndTime now. The ObjectAsMethodWrapper approach has a similar limitation: wrapper := ObjectAsMethodWrapper installOn: DateAndTime class selector: #now. "Debugging this line leads to 'Error: Instances of ObjectAsMethodWrapper are not indexable'" DateAndTime now. I'm going to take a look at the other MethodWrapper implementation, which I think creates CompiledMethods, so maybe that will fare better... Any other ideas? Thanks. Sean -- View this message in context: http://forum.world.st/Method-Wrappers-and-the-Debugger-tp4601773.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Sean P. DeNigris wrote
I'm going to take a look at the other MethodWrapper implementation, which I think creates CompiledMethods, so maybe that will fare better...
Indeed, the MethodWrappers on SqS (see http://forum.world.st/MethodWrappers-td3829576.html#a4601624) allows one to step over the wrapper in the debugger. Stepping in fails, but I expected that, and it's not so important to simulate the stub in the debugger... Sean -- View this message in context: http://forum.world.st/Method-Wrappers-and-the-Debugger-tp4601773p4601880.htm... Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
participants (1)
-
Sean P. DeNigris