Sha256: 1e7ac9cd2b015a6cb8337cc6aed52f98afd8340fe3a663eb971393eb398d6105

Contents?: true

Size: 912 Bytes

Versions: 1

Compression:

Stored size: 912 Bytes

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_empty < Test::RIO::TestCase
  @@once = false
  def self.once
    @@once = true

    rio('d0').rmtree.mkpath
    rio('d1').rmtree.mkpath.chdir {
      rio('file').touch
    }
    rio('f0').delete!.touch
    rio('f1').puts!("a nonempty file\n")
  end
  def setup
    super
    self.class.once unless @@once
  end
  def test_file_empty
    assert(rio('d0').empty?)
  end
  def test_file_not_empty
    assert!(rio('d1').empty?)
  end
  def test_dir_empty
    assert(rio('f0').empty?)
  end
  def test_dir_not_empty
    assert!(rio('f1').empty?)
  end
  def test_ps_empty
    assert(rio(?-,'ls d0').empty?)
  end
  def test_ps_not_empty
    assert!(rio(?-,'ls d1').empty?)
  end
  def test_dev_null_empty
    assert(rio(nil).empty?)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rio-0.3.8 test/tc/empty.rb