Forum: IronRuby Re: Code Review: Fix for File.print misbehavior

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jim D. (Guest)
on 2009-05-17 03:13
(Received via mailing list)
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.
Shri B. (Guest)
on 2009-05-17 09:27
(Received via mailing list)
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.
This topic is locked and can not be replied to.