TeX and CSS tweaks.
Sync with latest Instiki Trunk (Updates Rails to 1.2.2)
This commit is contained in:
parent
0ac586ee25
commit
c358389f25
443 changed files with 24218 additions and 9823 deletions
29
vendor/rails/actionpack/test/testing_sandbox.rb
vendored
29
vendor/rails/actionpack/test/testing_sandbox.rb
vendored
|
@ -1,26 +1,11 @@
|
|||
module TestingSandbox
|
||||
|
||||
# This whole thing *could* be much simpler, but I don't think Tempfile,
|
||||
# popen and others exist on all platforms (like Windows).
|
||||
def execute_in_sandbox(code)
|
||||
test_name = "#{File.dirname(__FILE__)}/test.#{$$}.rb"
|
||||
res_name = "#{File.dirname(__FILE__)}/test.#{$$}.out"
|
||||
|
||||
File.open(test_name, "w+") do |file|
|
||||
file.write(<<-CODE)
|
||||
$:.unshift "../lib"
|
||||
block = Proc.new do
|
||||
#{code}
|
||||
end
|
||||
print block.call
|
||||
CODE
|
||||
# Temporarily replaces KCODE for the block
|
||||
def with_kcode(kcode)
|
||||
old_kcode, $KCODE = $KCODE, kcode
|
||||
begin
|
||||
yield
|
||||
ensure
|
||||
$KCODE = old_kcode
|
||||
end
|
||||
|
||||
system("ruby #{test_name} > #{res_name}") or raise "could not run test in sandbox"
|
||||
File.read(res_name)
|
||||
ensure
|
||||
File.delete(test_name) rescue nil
|
||||
File.delete(res_name) rescue nil
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue