Sha256: 400df20157ccae77d01845276db1c1d3280527de99837075fbd2c1d0a92ebba0

Contents?: true

Size: 1.84 KB

Versions: 9

Compression:

Stored size: 1.84 KB

Contents

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

require 'rio'
require 'tc/testcase'

class TC_dirss < Test::Unit::TestCase
  include RIO_TestCase
  def setup()
    super
    unless @once
      @once = true
    end
  end
  def ztest_simple
#  p 'test_copyto_dir'
    d = rio('tdir').delete!.mkpath
    p d[]
    p d[]
  end
  def ztest_o
#  p 'test_copyto_dir'
    d = rio('tdir').delete!.mkpath
    f = rio(d,'f').touch
    sd = rio(d,'sd').mkpath
    p d[]
    d.files.each do |ent|
      #ent.extname = '.txt'
      p "#{ent} #{ent.ftype}"
    end
  end
  def ztest_each
#  p 'test_copyto_dir'
    d = rio('tdir').delete!.mkpath
    f = rio(d,'f').touch
    sd = rio(d,'sd').mkpath
    d.entries.each do |ent|
      p "#{ent} #{ent.ftype}"
    end
    d.files.each do |ent|
      #ent.extname = '.txt'
      p "#{ent} #{ent.ftype}"
    end
  end
  def test_dirs_files
#  p 'test_copyto_dir'
    d = rio('tdir').delete!.mkpath
    f = rio(d,'f').touch
    sd = rio(d,'sd').mkpath
    d.dirs.each do |ent|
      p "#{ent} #{ent.ftype}"
    end
    d.files.each do |ent|
      #ent.extname = '.txt'
      p "#{ent} #{ent.ftype}"
    end
  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{|el| el.to_s}
    ary = indir[]
    #p ary.map{|el| el.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

9 entries across 9 versions & 2 rubygems

Version Path
rio-0.6.0 test/tc/dirss.rb
wishdev-rio-0.4.3.1 test/tc/dirss.rb
rio-0.5.1 test/tc/dirss.rb
rio-0.3.9 test/tc/dirss.rb
rio-0.3.7 test/tc/dirss.rb
rio-0.3.8 test/tc/dirss.rb
rio-0.4.1 test/tc/dirss.rb
rio-0.4.2 test/tc/dirss.rb
rio-0.4.0 test/tc/dirss.rb