test/tc/expand_path.rb in rio-0.3.8 vs test/tc/expand_path.rb in rio-0.3.9
- old
+ new
@@ -3,85 +3,67 @@
Dir.chdir File.dirname(__FILE__)+'/../'
$:.unshift File.expand_path('../lib/')
end
require 'rio'
-require 'test/unit'
-require 'test/unit/testsuite'
+require 'tc/testcase'
-class TC_RIO_expand_path < Test::Unit::TestCase
- def initialize(*args)
- super
- @once = false
- @tdir = rio('qp/expand_path')
+class TC_RIO_expand_path < Test::RIO::TestCase
+ @@once = false
+ def self.once
+ @@once = true
+
end
- def assert!(a,msg="negative assertion")
- assert((!(a)),msg)
- end
- def smap(a) a.map{|el| el.to_s} end
+
def setup
- s_dir = ''
- #$trace_states = true
- unless @once
- @once = true
- @tdir.rmtree.mkpath
- end
+ super
+ self.class.once unless @@once
end
def test_expand_path_from_cwd
require 'tmpdir'
- tmp = rio('/tmp')
- unless tmp.dir?
- tmp = rio(RIO::RL.fs2url(::Dir.tmpdir))
- end
+
+ 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
- @tdir.chdir do
- 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
+ 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
- @tdir.chdir do
- 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
+ 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
- @tdir.chdir do
- 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
+ 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