1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

envutil.rb: using caller_locations

* test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
  take file and line by using caller_locations if not given.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-12-14 05:59:17 +00:00
parent 2bd5113c8c
commit c97dc42bb0
2 changed files with 10 additions and 3 deletions

View file

@ -1,4 +1,7 @@
Fri Dec 14 14:58:37 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
Fri Dec 14 14:59:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
take file and line by using caller_locations if not given.
* test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately):
count assertions in separated tests.

View file

@ -193,8 +193,12 @@ module Test
assert(status.success?, m)
end
def assert_separately(args, file, line, src)
opt = {}
def assert_separately(args, file = nil, line = nil, src, **opt)
unless file and line
loc, = caller_locations(1,1)
file ||= loc.path
line ||= loc.lineno
end
src = <<eom
require 'test/unit';include Test::Unit::Assertions;begin;#{src}
ensure