mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9933a6019f
commit
b3a4461df2
6 changed files with 21 additions and 14 deletions
|
@ -788,7 +788,7 @@ class CGI
|
||||||
# cookies and other parameters are parsed automatically from the standard
|
# cookies and other parameters are parsed automatically from the standard
|
||||||
# CGI locations, which varies according to the REQUEST_METHOD.
|
# CGI locations, which varies according to the REQUEST_METHOD.
|
||||||
def initialize(options = {}, &block) # :yields: name, value
|
def initialize(options = {}, &block) # :yields: name, value
|
||||||
@accept_charset_error_block=block if block_given?
|
@accept_charset_error_block = block_given? ? block : nil
|
||||||
@options={:accept_charset=>@@accept_charset}
|
@options={:accept_charset=>@@accept_charset}
|
||||||
case options
|
case options
|
||||||
when Hash
|
when Hash
|
||||||
|
|
|
@ -77,7 +77,7 @@ class CGIHeaderTest < Test::Unit::TestCase
|
||||||
else
|
else
|
||||||
expected = NoMethodError # for Ruby1.8
|
expected = NoMethodError # for Ruby1.8
|
||||||
end
|
end
|
||||||
ex = assert_raise(expected) do
|
assert_raise(expected) do
|
||||||
cgi.header(nil)
|
cgi.header(nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -71,7 +71,7 @@ class CGIModrubyTest < Test::Unit::TestCase
|
||||||
'status' => '200 OK',
|
'status' => '200 OK',
|
||||||
'location' => 'http://www.example.com/',
|
'location' => 'http://www.example.com/',
|
||||||
}
|
}
|
||||||
actual = cgi.header(options)
|
cgi.header(options)
|
||||||
assert_equal('200 OK', req.status_line) # should be '302 Found' ?
|
assert_equal('200 OK', req.status_line) # should be '302 Found' ?
|
||||||
assert_equal(302, req.status)
|
assert_equal(302, req.status)
|
||||||
assert_equal('http://www.example.com/', req.headers_out['location'])
|
assert_equal('http://www.example.com/', req.headers_out['location'])
|
||||||
|
@ -113,6 +113,7 @@ class Apache #:nodoc:
|
||||||
def hash.add(name, value)
|
def hash.add(name, value)
|
||||||
(self[name] ||= []) << value
|
(self[name] ||= []) << value
|
||||||
end
|
end
|
||||||
|
@http_header = nil
|
||||||
@headers_out = hash
|
@headers_out = hash
|
||||||
@status_line = nil
|
@status_line = nil
|
||||||
@status = nil
|
@status = nil
|
||||||
|
|
|
@ -119,7 +119,7 @@ class CGIMultipartTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def _prepare(data)
|
def _prepare(data)
|
||||||
## create multipart input
|
## create multipart input
|
||||||
multipart = MultiPart.new(@boundary)
|
multipart = MultiPart.new(defined?(@boundary) ? @boundary : nil)
|
||||||
data.each do |hash|
|
data.each do |hash|
|
||||||
multipart.append(hash[:name], hash[:value], hash[:filename])
|
multipart.append(hash[:name], hash[:value], hash[:filename])
|
||||||
end
|
end
|
||||||
|
@ -141,7 +141,7 @@ class CGIMultipartTest < Test::Unit::TestCase
|
||||||
|
|
||||||
def _test_multipart
|
def _test_multipart
|
||||||
caller(0).find {|s| s =~ /in `test_(.*?)'/ }
|
caller(0).find {|s| s =~ /in `test_(.*?)'/ }
|
||||||
testname = $1
|
#testname = $1
|
||||||
#$stderr.puts "*** debug: testname=#{testname.inspect}"
|
#$stderr.puts "*** debug: testname=#{testname.inspect}"
|
||||||
_prepare(@data)
|
_prepare(@data)
|
||||||
cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
|
cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
|
||||||
|
@ -270,7 +270,7 @@ class CGIMultipartTest < Test::Unit::TestCase
|
||||||
input2
|
input2
|
||||||
end
|
end
|
||||||
ex = assert_raise(EOFError) do
|
ex = assert_raise(EOFError) do
|
||||||
cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
|
RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
|
||||||
end
|
end
|
||||||
assert_equal("bad content body", ex.message)
|
assert_equal("bad content body", ex.message)
|
||||||
#
|
#
|
||||||
|
@ -281,7 +281,7 @@ class CGIMultipartTest < Test::Unit::TestCase
|
||||||
input2
|
input2
|
||||||
end
|
end
|
||||||
ex = assert_raise(EOFError) do
|
ex = assert_raise(EOFError) do
|
||||||
cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
|
RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
|
||||||
end
|
end
|
||||||
assert_equal("bad content body", ex.message)
|
assert_equal("bad content body", ex.message)
|
||||||
end
|
end
|
||||||
|
|
|
@ -110,7 +110,7 @@ class CGISessionTest < Test::Unit::TestCase
|
||||||
assert_equal(value1,session["key1"])
|
assert_equal(value1,session["key1"])
|
||||||
assert_equal(value2,session["key2"])
|
assert_equal(value2,session["key2"])
|
||||||
assert_equal("foo",session.session_id)
|
assert_equal("foo",session.session_id)
|
||||||
session_id=session.session_id
|
#session_id=session.session_id
|
||||||
session.close
|
session.close
|
||||||
$stdout = StringIO.new
|
$stdout = StringIO.new
|
||||||
cgi.out{""}
|
cgi.out{""}
|
||||||
|
|
|
@ -59,7 +59,13 @@ class TestERBCore < Test::Unit::TestCase
|
||||||
_test_core(0)
|
_test_core(0)
|
||||||
_test_core(1)
|
_test_core(1)
|
||||||
_test_core(2)
|
_test_core(2)
|
||||||
_test_core(3)
|
orig = $VERBOSE
|
||||||
|
begin
|
||||||
|
$VERBOSE = false
|
||||||
|
_test_core(3)
|
||||||
|
ensure
|
||||||
|
$VERBOSE = orig
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def _test_core(safe)
|
def _test_core(safe)
|
||||||
|
@ -192,26 +198,26 @@ EOS
|
||||||
%n = 1
|
%n = 1
|
||||||
<%= n%>
|
<%= n%>
|
||||||
EOS
|
EOS
|
||||||
assert_equal("1\n", ERB.new(src, nil, '%').result)
|
assert_equal("1\n", ERB.new(src, nil, '%').result(binding))
|
||||||
|
|
||||||
src = <<EOS
|
src = <<EOS
|
||||||
<%
|
<%
|
||||||
%>
|
%>
|
||||||
EOS
|
EOS
|
||||||
ans = "\n"
|
ans = "\n"
|
||||||
assert_equal(ans, ERB.new(src, nil, '%').result)
|
assert_equal(ans, ERB.new(src, nil, '%').result(binding))
|
||||||
|
|
||||||
src = "<%\n%>"
|
src = "<%\n%>"
|
||||||
# ans = "\n"
|
# ans = "\n"
|
||||||
ans = ""
|
ans = ""
|
||||||
assert_equal(ans, ERB.new(src, nil, '%').result)
|
assert_equal(ans, ERB.new(src, nil, '%').result(binding))
|
||||||
|
|
||||||
src = <<EOS
|
src = <<EOS
|
||||||
<%
|
<%
|
||||||
n = 1
|
n = 1
|
||||||
%><%= n%>
|
%><%= n%>
|
||||||
EOS
|
EOS
|
||||||
assert_equal("1\n", ERB.new(src, nil, '%').result)
|
assert_equal("1\n", ERB.new(src, nil, '%').result(binding))
|
||||||
|
|
||||||
src = <<EOS
|
src = <<EOS
|
||||||
%n = 1
|
%n = 1
|
||||||
|
@ -227,7 +233,7 @@ EOS
|
||||||
% %%><%1
|
% %%><%1
|
||||||
%%
|
%%
|
||||||
EOS
|
EOS
|
||||||
assert_equal(ans, ERB.new(src, nil, '%').result)
|
assert_equal(ans, ERB.new(src, nil, '%').result(binding))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_def_erb_method
|
def test_def_erb_method
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue