On Thu Oct 16 17:43:28 2008, mgrimes wrote: > Hi, > > The attached patch converts two perl based tests into parrot tests: > > t/pmc/string.t > t/pmc/objects.t > > Each of these included "pir_error_is" type tests. I am not aware of > any way to test those within parrot right now, so I kept them in perl > tests and move them to t/pmc/string-errors.t and > t/pmc/objects-errors.t. > > Converting these test to pir dropped their run time from 19 secs to 3 > secs, and more than 2 of those seconds are spent in the *-errors.t > tests. > > Unfortunately, I ran into a small issue applying the patch. Since I am > changing lines near the "# $Id:....$" line, "svn diff" creates a patch > that doesn't apply cleanly. The following one liner will clean up the > $Id: line, so the patch applies cleanly. > > $ perl -i.bak -pe's/# \$Id: .*$/# \$Id\$/' t/pmc/string.t t/pmc/objects.t > > If there is a better way to make the patch, please let me know. > > Thanks, > Mark
You can fix the foo_error_bar tests by using an exception handler to catch the (appropriate type of) exception. The simplest way is to use push_eh with a label. If the exception is raised, control will jump to that label. t/pmc/resizablestringarray.t uses this style. The more fine-grained approach is to use an ExceptionHandler PMC. t/pmc/ro.t uses this style. This lets you set the types and min/max severity that the eh will handle and resume execution. t/pmc/exceptionhandler.t has some nice examples. Thanks for rewriting those two tests. I thought about tackling them when I was on my PIRifying binge, but I didn't have nearly enough patience at the time.