mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Back out the previous change after miniunit import.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19660 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
179b7eaa6b
commit
c6866f8552
1 changed files with 12 additions and 12 deletions
|
@ -257,17 +257,17 @@ class TestPathname < Test::Unit::TestCase
|
||||||
defassert(:relative_path_from, "a", "a", "b/..")
|
defassert(:relative_path_from, "a", "a", "b/..")
|
||||||
defassert(:relative_path_from, "b/c", "b/c", "b/..")
|
defassert(:relative_path_from, "b/c", "b/c", "b/..")
|
||||||
|
|
||||||
def self.defassert_raises(name, exc, *args)
|
def self.defassert_raise(name, exc, *args)
|
||||||
define_assertion(name) {
|
define_assertion(name) {
|
||||||
message = "#{name}(#{args.map {|a| a.inspect }.join(', ')})"
|
message = "#{name}(#{args.map {|a| a.inspect }.join(', ')})"
|
||||||
assert_raises(exc, message) { self.send(name, *args) }
|
assert_raise(exc, message) { self.send(name, *args) }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
defassert_raises(:relative_path_from, ArgumentError, "/", ".")
|
defassert_raise(:relative_path_from, ArgumentError, "/", ".")
|
||||||
defassert_raises(:relative_path_from, ArgumentError, ".", "/")
|
defassert_raise(:relative_path_from, ArgumentError, ".", "/")
|
||||||
defassert_raises(:relative_path_from, ArgumentError, "a", "..")
|
defassert_raise(:relative_path_from, ArgumentError, "a", "..")
|
||||||
defassert_raises(:relative_path_from, ArgumentError, ".", "..")
|
defassert_raise(:relative_path_from, ArgumentError, ".", "..")
|
||||||
|
|
||||||
def realpath(path)
|
def realpath(path)
|
||||||
Pathname.new(path).realpath.to_s
|
Pathname.new(path).realpath.to_s
|
||||||
|
@ -282,9 +282,9 @@ class TestPathname < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
Dir.mktmpdir('rubytest-pathname') {|dir|
|
Dir.mktmpdir('rubytest-pathname') {|dir|
|
||||||
File.symlink("not-exist-target", "#{dir}/not-exist")
|
File.symlink("not-exist-target", "#{dir}/not-exist")
|
||||||
assert_raises(Errno::ENOENT) { realpath("#{dir}/not-exist") }
|
assert_raise(Errno::ENOENT) { realpath("#{dir}/not-exist") }
|
||||||
File.symlink("loop", "#{dir}/loop")
|
File.symlink("loop", "#{dir}/loop")
|
||||||
assert_raises(Errno::ELOOP) { realpath("#{dir}/loop") }
|
assert_raise(Errno::ELOOP) { realpath("#{dir}/loop") }
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -314,7 +314,7 @@ class TestPathname < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_initialize_nul
|
def test_initialize_nul
|
||||||
assert_raises(ArgumentError) { Pathname.new("a\0") }
|
assert_raise(ArgumentError) { Pathname.new("a\0") }
|
||||||
end
|
end
|
||||||
|
|
||||||
class AnotherStringLike # :nodoc:
|
class AnotherStringLike # :nodoc:
|
||||||
|
@ -409,7 +409,7 @@ class TestPathname < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_null_character
|
def test_null_character
|
||||||
assert_raises(ArgumentError) { Pathname.new("\0") }
|
assert_raise(ArgumentError) { Pathname.new("\0") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_taint
|
def test_taint
|
||||||
|
@ -462,8 +462,8 @@ class TestPathname < Test::Unit::TestCase
|
||||||
str = "a"
|
str = "a"
|
||||||
obj = Pathname.new(str)
|
obj = Pathname.new(str)
|
||||||
assert_equal(str, obj.to_s)
|
assert_equal(str, obj.to_s)
|
||||||
refute_same(str, obj.to_s)
|
assert_not_same(str, obj.to_s)
|
||||||
refute_same(obj.to_s, obj.to_s)
|
assert_not_same(obj.to_s, obj.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_kernel_open
|
def test_kernel_open
|
||||||
|
|
Loading…
Add table
Reference in a new issue