Sha256: 572b6eb3ce644be9f089e232a38b66313e1114e17973490c2b20addc06bb7e80

Contents?: true

Size: 1.35 KB

Versions: 2

Compression:

Stored size: 1.35 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'
require 'tmpdir'

class TC_tempfile < Test::RIO::TestCase
  @@once = false
  def self.once
    @@once = true
  end
  def setup
    super
    self.class.once unless @@once
    @tmpdir = ::Dir::tmpdir
    @pfx = 'rio'
  end

  def pathinfo(ario)
    [:scheme,:opaque,:path,:fspath,:to_s,:to_url,:to_uri].each do |sym|
      puts "#{sym}: #{ario.__send__(sym)}"
    end
  end

  def test_new
    tmpdir = rio('tempdir:')
    assert(tmpdir.dir?)
    assert_equal(::Dir::tmpdir,tmpdir.dirname.to_s)
  end

  def test_prefix
    tmpdir = rio('tempdir:','zippy')
    assert_match(/^zippy/,tmpdir.filename.to_s)
  end

  def test_tmpdir
    rio('riotmpdir').delete!.mkdir
    tmpdir = rio('tempdir:','zippy','riotmpdir')
    assert_match(/^zippy/,tmpdir.filename.to_s)
    assert_match('riotmpdir',tmpdir.dirname.to_s)
  end

  def test_prefix_url
    tmpdir = rio('tempdir:zippy')
    assert_match(/^zippy/,tmpdir.filename.to_s)
  end

  def test_tmpdir_url
    rio('riotmpdir').delete!.mkdir
    tmpdir = rio('tempdir:riotmpdir/zippy')
    assert_match(/^zippy/,tmpdir.filename.to_s)
    assert_match('riotmpdir',tmpdir.dirname.to_s)
  end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rio-0.3.2 test/tc/tempdir.rb
rio-0.3.3 test/tc/tempdir.rb