Sha256: d48bd3359e6ec66c254264b1992b9ef4db60221f9178689635af03ab815ed413

Contents?: true

Size: 1.67 KB

Versions: 5

Compression:

Stored size: 1.67 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'

class TC_RIO_edf < Test::Unit::TestCase
  def tdir() rio(%w/qp edf/) end
  def assert!(a,msg="negative assertion")
    assert((!(a)),msg)
  end
  require 'extensions/symbol'
  def smap(a) a.map( &:to_s ) end
  def mkafile(*args)
    file = rio(*args)
    file < (0..1).map { |i| "L#{i}:#{file.to_s}\n" }
    file
  end
  def mkalinesfile(n_lines,*args)
    file = rio(*args)
    file < (0...n_lines).map { |i| "L#{i}:#{file.to_s}\n" }
    file
  end
  def setup
    #$trace_states = true
    unless @once
      @once = true
      tdir.delete!.mkpath.chdir do
        mkafile('f1.txt')
        mkafile('f2.asc')
        rio('d0').mkdir
        rio('d1').mkdir.chdir do
          mkafile('f0.txt')
        end
        rio('d2').mkdir.chdir do
          mkafile('f1.asc')
          mkafile('f1.txt')
          mkafile('f2.txt')
          rio('d3').mkdir.chdir do
            mkafile('f0.txt')
            mkafile('f2.txt')
            mkafile('f1.txt')
          end
        end
      end
    end
    @cwd = ::Dir.getwd
    tdir.mkpath.chdir
  end
  def teardown
    ::Dir.chdir @cwd
  end

  def test_basic

    ans = rio('d2').files[]
    p smap(ans)
    ans.clear
    $trace_states = false
    rio('d2').files(/\.txt$/).each { |ent| ans << ent }
    $trace_states = false

    p smap(ans)

    ans = rio('d2').files(/\.txt$/)[]
    p smap(ans)

    ans = rio('d2').files[/\.txt$/]
    p smap(ans)

    ans = rio('d2').files('*.txt')[]
    p smap(ans)

    ans = rio('d2').files['*.txt']
    p smap(ans)

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

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