mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/inlinetest.rb (InlineTest::loadtest): requiring library with
replaced $0 can make $0 == __FILE__ block be evaluated twice. [ruby-dev:23538] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3ac7b642fa
commit
c504ca6776
2 changed files with 15 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
Wed May 19 18:00:44 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* test/inlinetest.rb (InlineTest::loadtest): requiring library with
|
||||
replaced $0 can make $0 == __FILE__ block be evaluated twice.
|
||||
[ruby-dev:23538]
|
||||
|
||||
Wed May 19 11:08:10 2004 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
|
||||
|
||||
* ext/tk/lib/tk.rb: change permition of TkObject#tk_send from
|
||||
|
|
|
@ -6,12 +6,12 @@ module InlineTest
|
|||
if endpart.nil?
|
||||
raise RuntimeError.new("No #{part} part in the library '#{filename}'")
|
||||
end
|
||||
require(libname)
|
||||
eval(endpart, TOPLEVEL_BINDING, path, mainpart.count("\n")+1)
|
||||
end
|
||||
module_function :eval_part
|
||||
|
||||
def loadtest(libname)
|
||||
require(libname)
|
||||
in_critical do
|
||||
in_progname(libpath(libname)) do
|
||||
eval_part(libname, /^(?=if\s+(?:\$0\s*==\s*__FILE__|__FILE__\s*==\s*\$0)(?:[\#\s]|$))/, '$0 == __FILE__')
|
||||
|
@ -21,6 +21,7 @@ module InlineTest
|
|||
module_function :loadtest
|
||||
|
||||
def loadtest__END__part(libname)
|
||||
require(libname)
|
||||
eval_part(libname, /^__END__$/, '__END__')
|
||||
end
|
||||
module_function :loadtest__END__part
|
||||
|
|
Loading…
Reference in a new issue