Feature #40

ARGF specs not implemented

Added by Laurent Julliard 134 days ago. Updated 130 days ago.

Status :New Start :07/09/2008
Priority :Normal Due date :
Assigned to :Brian Ford % Done :

100%

Category :-
Target version :- Estimated time :10.00 hours

Description

I'm working on it. Will go in rubyspec/1.8/core/argf/

0001-Initial-version-of-ARGF-specs.patch - Patch for ARGF specs (50.2 KB) Laurent Julliard, 07/12/2008 10:48 AM

History

07/12/2008 10:48 AM - Laurent Julliard

ARGF specs attached

07/12/2008 10:59 AM - Brian Ford

Laurent,

Awesome. That is a lot of work! Most of it looks great. Here are a couple suggestions:

  • Use ARGV.close unless ARGV.closed? because the 'rescue nil' has obscured bugs in the past
  • You could create a helper in ARGFSpec for this sort of thing: File.read(File.dirname(__FILE__) + '/fixtures/file1.txt') or we could add a helper to mspec like fixture("file1.txt") that would return File.dirname(__FILE__) + "/fixtures/#{name}" and you can File.read, File.open, etc.

07/12/2008 11:16 AM - Brian Ford

Here are some issues I see on OS X intel when running all the specs with 'mspec -tr .'

2)
IO#fileno returns the numeric file descriptor of the given IO object FAILED
Expected 3
 to equal 1

./1.8/core/io/fileno_spec.rb:6
./1.8/core/io/fileno_spec.rb:2:in `all?'
./1.8/core/io/fileno_spec.rb:4

3)
IO #print writes $_.to_s followed by $\ (if any) to the stream if no arguments given FAILED
Expected (STDOUT): "I know what you did last line!->" 
         but got: "" 
Backtrace
./1.8/core/io/print_spec.rb:23
./1.8/core/io/print_spec.rb:2:in `all?'
./1.8/core/io/print_spec.rb:4

4)
IO#puts writes just a newline when given just a newline FAILED
Expected (STDOUT): "\n" 
          but got: "" 
Backtrace
./1.8/core/io/puts_spec.rb:19
./1.8/core/io/puts_spec.rb:8

5)
IO#to_i return the numeric file descriptor of the given IO object FAILED
Expected 3
 to equal 1

./1.8/core/io/to_i_spec.rb:6
./1.8/core/io/to_i_spec.rb:2:in `all?'
./1.8/core/io/to_i_spec.rb:4

6)
Kernel#p is not affected by setting $\, $/ or $, FAILED
Expected (STDOUT): "Next time, Gadget, NEXT TIME!\n" 
         but got: "" 
Backtrace
./1.8/core/kernel/p_spec.rb:53
./1.8/core/kernel/p_spec.rb:4

07/13/2008 02:30 PM - Laurent Julliard

  • Estimated time changed from 8.0 to 10.0
  • % Done changed from 0 to 100
  • Assigned to set to Brian Ford

Contrary to what I said yesterday i observed the same side effect on IO specs and fiwed the problems. It turned out that testing ARGF with in place editing had side effect on the internal Ruby IOs which caused the errors.

The solution was to run the tests dealing with in place editing in separate Ruby process to avoid any side effect. It works flawlessly on my side now. Can you test on Mac OS X?

Thanks!

Also available in: Atom PDF