Sha256: d36aa8afa79a582f475c70cdd1ba84f8cb4f38a5a7b97d8da9f2f8de59b49298

Contents?: true

Size: 1.91 KB

Versions: 5

Compression:

Stored size: 1.91 KB

Contents

#!/usr/local/bin/ruby
if $0 == __FILE__
  Dir.chdir File.dirname(__FILE__)+'/../'
  $:.unshift File.expand_path('../lib/')
end

require 'rio'
require 'test/unit'
require 'test/unit/testsuite'
require 'extensions/symbol'
require 'tc/testcase'

class TC_dirss < Test::Unit::TestCase
  include RIO_TestCase
  def setup()
    super
    unless @once
      @once = true
      @l = []; @f = []; @d = []
      @d[0] = rio('a').rmtree.mkpath
      @d[1] = rio('b').rmtree.mkpath
      #$trace_states = false
      #$trace_states = true
      @l[0],@f[0] = lines_file(3,'a/f0')
      @l[1],@f[1] = lines_file(2,'a/f1')
      @d[1] < @d[0]
      @d[1] < @d[0].files[]
    end
  end
  def test_rename_add_ext_check_
#  p 'test_copyto_dir'
    assert_equal(@l[0],rio(@d[1],@f[0].basename).lines[])
    assert_equal(@l[1],rio(@d[1],@f[1].basename).lines[])
    rio('tdir').delete!.mkpath < rio(@d[1]).to_a
    indir = rio('tdir')
    #indir = @d[1]
    $trace_states = true
    p indir.map(&:to_s)
    ary = indir[]
    #p ary.map(&:to_s)
    p indir,indir.ioh
    newext = '.txt'
    indir.files.rename.each { |ent|
      ent.extname = newext
    }
    $trace_states = false
    assert_equal(@l[0],rio(indir,@f[0].basename.to_s + newext).lines[])
    assert_equal(@l[1],rio(indir,@f[1].basename.to_s + newext).lines[])
  end
  def atest_rename_add_ext_check_
#  p 'test_copyto_dir'
    assert_equal(@l[0],rio(@d[1],@f[0].basename).lines[])
    assert_equal(@l[1],rio(@d[1],@f[1].basename).lines[])
    rio('tdir').delete!.mkpath < rio(@d[1]).to_a
    indir = rio('tdir')
    #indir = @d[1]
    $trace_states = true
    p indir.map(&:to_s)
    ary = indir[]
    #p ary.map(&:to_s)
    p indir,indir.ioh
    newext = '.txt'
    indir.files.rename.each { |ent|
      ent.extname = newext
    }
    $trace_states = false
    assert_equal(@l[0],rio(indir,@f[0].basename.to_s + newext).lines[])
    assert_equal(@l[1],rio(indir,@f[1].basename.to_s + newext).lines[])
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rio-0.3.1 test/tc/dirautoclose.rb
rio-0.3.2 test/tc/dirautoclose.rb
rio-0.3.6 test/tc/dirautoclose.rb
rio-0.3.3 test/tc/dirautoclose.rb
rio-0.3.4 test/tc/dirautoclose.rb