Sha256: dda4311976d14c3d6628d3e8e1842c008c21a70ba3f97364424051a797ab90cd

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 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_io
    str = "Hello Tempfile"
    assert_equal(str,rio(??).puts(str).rewind.chomp.gets)
  end

  def test_rl_temp
    str = "Hello Tempfile"
    tmp = rio('temp:')
    assert(tmp.closed?)
    assert_equal(str,tmp.puts(str).rewind.chomp.gets)
  end

  def test_rl_tempfile
    str = "Hello Tempfile"
    #$trace_states = true
    tmp = rio('tempfile:')
    assert(tmp.closed?)
    tmp.puts(str)
    assert(tmp.open?)
    assert_equal(str,tmp.rewind.chomp.gets)
  end


end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rio-0.3.6 test/tc/tempfile.rb
rio-0.3.4 test/tc/tempfile.rb
rio-0.3.3 test/tc/tempfile.rb