* test/inlinetest.rb (InlineTest::loadtest): require instead of
load, to get rid of multiple loading. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7e932df0d5
commit
8802ebc9e1
@ -1,3 +1,8 @@
|
|||||||
|
Wed Jan 14 17:54:17 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* test/inlinetest.rb (InlineTest::loadtest): require instead of
|
||||||
|
load, to get rid of multiple loading.
|
||||||
|
|
||||||
Wed Jan 14 13:30:52 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Wed Jan 14 13:30:52 2004 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* ext/iconv/extconf.rb: wrapper iconv.rb is dependent on platform.
|
* ext/iconv/extconf.rb: wrapper iconv.rb is dependent on platform.
|
||||||
|
@ -1,21 +1,28 @@
|
|||||||
module InlineTest
|
module InlineTest
|
||||||
|
def eval_part(libname, sep, part)
|
||||||
|
path = libpath(libname)
|
||||||
|
program = File.open(path) { |f| f.read }
|
||||||
|
mainpart, endpart = program.split(sep)
|
||||||
|
if endpart.nil?
|
||||||
|
raise RuntimeError.new("No #{part} part in the library '#{filename}'")
|
||||||
|
end
|
||||||
|
require(libname)
|
||||||
|
eval(endpart, nil, path, mainpart.count("\n")+1)
|
||||||
|
end
|
||||||
|
module_function :eval_part
|
||||||
|
|
||||||
def loadtest(libname)
|
def loadtest(libname)
|
||||||
|
Kernel.require(libname)
|
||||||
in_critical do
|
in_critical do
|
||||||
in_progname(libpath(libname)) do
|
in_progname(libpath(libname)) do
|
||||||
Kernel.load(libname)
|
eval_part(libname, /^(?=if\s+(?:\$0\s*==\s*__FILE__|__FILE__\s*==\s*\$0)(?:[\#\s]|$))/, '$0 == __FILE__')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
module_function :loadtest
|
module_function :loadtest
|
||||||
|
|
||||||
def loadtest__END__part(libname)
|
def loadtest__END__part(libname)
|
||||||
program = File.open(libpath(libname)) { |f| f.read }
|
eval_part(libname, /^__END__$/, '__END__')
|
||||||
mainpart, endpart = program.split(/^__END__$/)
|
|
||||||
if endpart.nil?
|
|
||||||
raise RuntimeError.new("No __END__ part in the library '#{filename}'")
|
|
||||||
end
|
|
||||||
require(libname)
|
|
||||||
eval(endpart)
|
|
||||||
end
|
end
|
||||||
module_function :loadtest__END__part
|
module_function :loadtest__END__part
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user