Re: Code Review: Fix for File.print misbehavior


#1

I would be opposed to making the MSpec runner depend on any more
stdlibs. I would suggest making a helper that swaps the IOStub with the
real stdout for the duration of a block.

JD

…there is no try
Sent from my phone. Please excuse typos and txtspk.


#2

The “output” matcher from the snippet below swaps stdout with IOStub in
order to be able to capture the output of the block. Swapping IOStub
back with real stdout will not work as you will not know what the block
printed…

lambda { $stdout.print(o, o2) }.should 

output("#{o.to_s}#{o2.to_s}#{$}")

One hybrid way to fix this would be for the “output” matcher to take an
IO object as a second optional parameter that is used to capture the
output intead of using IOStub. Then print_spec.rb could provide a
StringIO object. Currently, print_spec.rb is busted and does not test
what it is supposed to. Taking a dependency on a stdlib (stringio) would
not be worse thing in this case.

I do not feel strongly about fixing this right now…


From: removed_email_address@domain.invalid
[removed_email_address@domain.invalid] On Behalf Of Jim D.
[removed_email_address@domain.invalid]
Sent: Saturday, May 16, 2009 4:05 PM
To: removed_email_address@domain.invalid
Subject: Re: [Ironruby-core] Code Review: Fix for File.print misbehavior

I would be opposed to making the MSpec runner depend on any more
stdlibs. I would suggest making a helper that swaps the IOStub with the
real stdout for the duration of a block.

JD

…there is no try
Sent from my phone. Please excuse typos and txtspk.