Sha256: de6b457a959e6748401d498278a8a4579b8e920b613223fdbab1cf239fdd0eeb

Contents?: true

Size: 1.35 KB

Versions: 5

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 'tc/testcase'

class TC_RIO_expand_path < Test::RIO::TestCase
  @@once = false
  def self.once
    @@once = true

  end

  def setup
    super
    self.class.once unless @@once
  end

  def test_expand_path_from_cwd
    require 'tmpdir'

    tmp = rio(::Dir.tmpdir)
    tmp.chdir do
      rel = rio('groovy')
      exp = rio(tmp,rel)
      ans = rel.expand_path
      assert_kind_of(RIO::Rio,ans)
      assert_equal(exp,ans)
    end
  end

  def test_expand_path_from_base_rio
    srel = 'groovy'
    sbase = '/tmp'
    rel = rio(srel)
    base = rio(sbase)
    exp = File.expand_path(srel,sbase)
    ans = rel.expand_path(base)
    assert_kind_of(RIO::Rio,ans)
    assert_equal(exp,ans)
  end

  def test_expand_path_from_base_string
    srel = 'groovy'
    sbase = '/tmp'
    rel = rio(srel)
    base = rio(sbase)
    exp = File.expand_path(srel,sbase)
    ans = rel.expand_path(sbase)
    assert_kind_of(RIO::Rio,ans)
    assert_equal(exp,ans)
  end

  def test_expand_path_from_tilde
    return if $mswin32
    srel = 'groovy'
    sbase = '~'
    rel = rio(srel)
    base = rio(sbase)
    exp = File.expand_path(srel,sbase)
    ans = rel.expand_path(sbase)
    assert_kind_of(RIO::Rio,ans)
    assert_equal(exp,ans)
  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
wishdev-rio-0.4.3.1 test/tc/expand_path.rb
rio-0.3.9 test/tc/expand_path.rb
rio-0.4.0 test/tc/expand_path.rb
rio-0.4.1 test/tc/expand_path.rb
rio-0.4.2 test/tc/expand_path.rb