aboutsummaryrefslogtreecommitdiffstats
path: root/test/pathname
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-15 03:36:57 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-15 03:36:57 +0000
commit19853fc49b20626052d6cc92dbd7b08ecce03039 (patch)
tree2575286bce5050eb28e7af732946a05c1f9343ac /test/pathname
parent071b8d76f0e920e510ffcb3dc6028ee863112b13 (diff)
downloadruby-19853fc49b20626052d6cc92dbd7b08ecce03039.tar.gz
* test/ruby/test_io.rb (test_copy_stream_socket): wait a child process
before SIGUSR1 handler is removed. * test/pathname/test_pathname.rb (define_assertion): use line number for test method names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/pathname')
-rw-r--r--test/pathname/test_pathname.rb32
1 files changed, 19 insertions, 13 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb
index 8f2445eacd..ac9b415022 100644
--- a/test/pathname/test_pathname.rb
+++ b/test/pathname/test_pathname.rb
@@ -10,15 +10,21 @@ require 'enumerator'
require_relative '../ruby/envutil'
class TestPathname < Test::Unit::TestCase
- def self.define_assertion(name, &block)
- @defassert_num ||= {}
- @defassert_num[name] ||= 0
- @defassert_num[name] += 1
- define_method("test_#{name}_#{@defassert_num[name]}", &block)
+ def self.define_assertion(name, linenum, &block)
+ name = "test_#{name}_#{linenum}"
+ define_method(name, &block)
+ end
+
+ def self.get_linenum
+ if /:(\d+):/ =~ caller[1]
+ $1.to_i
+ else
+ nil
+ end
end
def self.defassert(name, result, *args)
- define_assertion(name) {
+ define_assertion(name, get_linenum) {
mesg = "#{name}(#{args.map {|a| a.inspect }.join(', ')})"
assert_nothing_raised(mesg) {
assert_equal(result, self.send(name, *args), mesg)
@@ -26,6 +32,13 @@ class TestPathname < Test::Unit::TestCase
}
end
+ def self.defassert_raise(name, exc, *args)
+ define_assertion(name, get_linenum) {
+ message = "#{name}(#{args.map {|a| a.inspect }.join(', ')})"
+ assert_raise(exc, message) { self.send(name, *args) }
+ }
+ end
+
DOSISH = File::ALT_SEPARATOR != nil
DOSISH_DRIVE_LETTER = File.dirname("A:") == "A:."
DOSISH_UNC = File.dirname("//") == "//"
@@ -294,13 +307,6 @@ class TestPathname < Test::Unit::TestCase
defassert(:relative_path_from, "a", "a", "b/..")
defassert(:relative_path_from, "b/c", "b/c", "b/..")
- def self.defassert_raise(name, exc, *args)
- define_assertion(name) {
- message = "#{name}(#{args.map {|a| a.inspect }.join(', ')})"
- assert_raise(exc, message) { self.send(name, *args) }
- }
- end
-
defassert_raise(:relative_path_from, ArgumentError, "/", ".")
defassert_raise(:relative_path_from, ArgumentError, ".", "/")
defassert_raise(:relative_path_from, ArgumentError, "a", "..")