#326 √ resolved
Ragnar Dahlén

[PATCH] Implement File#truncate

Reported by Ragnar Dahlén | February 13th, 2008 @ 10:40 AM | in 1.0 preview

Implementation of File#truncate.

Fails one spec:

Does not raise IOError when truncating a file opened only for reading, instead raises EINVAL through Errno.handle.

p190-n239:rubinius ragge$ bin/mspec -t x spec/ruby/1.8/core/file/truncate_spec.rb
Started
..................F.

1)
File#truncate raises an IOError if file is not opened for writing FAILED
Expected IOError but got EINVAL (Invalid argument): 
            Expectation.fail_with at ./mspec/expectations.rb:10
    Object(Proc::Function)#should at ./mspec/expectations/should.rb:6
             Object#__script__ {} at ./spec/ruby/1.8/core/file/truncate_spec.rb:158
                        Proc#call at kernel/core/proc.rb:81
           SpecRunner#describe {} at ./mspec/runner/runner.rb:147
                       Array#each at kernel/core/array.rb:565
              SpecRunner#describe at ./mspec/runner/runner.rb:156
                  Object#describe at ./mspec/runner/object.rb:11
                Object#__script__ at ./spec/ruby/1.8/core/file/truncate_spec.rb:88
         CompiledMethod#as_script at kernel/core/compiled_method.rb:211
              Compile.single_load at kernel/core/compile.rb:214
          Compile.unified_load {} at kernel/core/compile.rb:133
                       Array#each at kernel/core/array.rb:565
             Compile.unified_load at kernel/core/compile.rb:113
              Kernel(Object)#load at kernel/core/compile.rb:364
             Object#__script__ {} at tmp/last_mspec.rb:15
                       Array#each at kernel/core/array.rb:565
                Object#__script__ at tmp/last_mspec.rb:20
         CompiledMethod#as_script at kernel/core/compiled_method.rb:211
              Compile.single_load at kernel/core/compile.rb:214
      Compile.load_from_extension at kernel/core/compile.rb:291
                Object#__script__ at kernel/loader.rb:184

Finished in 0.057795 seconds

20 examples, 42 expectations, 1 failure, 0 errors

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Tags