[前][次][番号順一覧][スレッド一覧]

ruby-changes:24643

From: naruse <ko1@a...>
Date: Tue, 14 Aug 2012 15:52:51 +0900 (JST)
Subject: [ruby-changes:24643] naruse:r36694 (trunk): Suppress warnings.

naruse	2012-08-14 15:52:41 +0900 (Tue, 14 Aug 2012)

  New Revision: 36694

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36694

  Log:
    Suppress warnings.

  Modified files:
    trunk/lib/cgi/core.rb
    trunk/test/cgi/test_cgi_header.rb
    trunk/test/cgi/test_cgi_modruby.rb
    trunk/test/cgi/test_cgi_multipart.rb
    trunk/test/cgi/test_cgi_session.rb
    trunk/test/erb/test_erb.rb

Index: lib/cgi/core.rb
===================================================================
--- lib/cgi/core.rb	(revision 36693)
+++ lib/cgi/core.rb	(revision 36694)
@@ -788,7 +788,7 @@
   # cookies and other parameters are parsed automatically from the standard
   # CGI locations, which varies according to the REQUEST_METHOD.
   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}
     case options
     when Hash
Index: test/erb/test_erb.rb
===================================================================
--- test/erb/test_erb.rb	(revision 36693)
+++ test/erb/test_erb.rb	(revision 36694)
@@ -59,7 +59,13 @@
     _test_core(0)
     _test_core(1)
     _test_core(2)
-    _test_core(3)
+    orig = $VERBOSE
+    begin
+      $VERBOSE = false
+      _test_core(3)
+    ensure
+      $VERBOSE = orig
+    end
   end
 
   def _test_core(safe)
@@ -192,26 +198,26 @@
 %n = 1
 <%= n%>
 EOS
-    assert_equal("1\n", ERB.new(src, nil, '%').result)
+    assert_equal("1\n", ERB.new(src, nil, '%').result(binding))
 
     src = <<EOS
 <%
 %>
 EOS
     ans = "\n"
-    assert_equal(ans, ERB.new(src, nil, '%').result)
+    assert_equal(ans, ERB.new(src, nil, '%').result(binding))
 
     src = "<%\n%>"
     # ans = "\n"
     ans = ""
-    assert_equal(ans, ERB.new(src, nil, '%').result)
+    assert_equal(ans, ERB.new(src, nil, '%').result(binding))
 
     src = <<EOS
 <%
 n = 1
 %><%= n%>
 EOS
-    assert_equal("1\n", ERB.new(src, nil, '%').result)
+    assert_equal("1\n", ERB.new(src, nil, '%').result(binding))
 
     src = <<EOS
 %n = 1
@@ -227,7 +233,7 @@
 % %%><%1
 %%
 EOS
-    assert_equal(ans, ERB.new(src, nil, '%').result)
+    assert_equal(ans, ERB.new(src, nil, '%').result(binding))
   end
 
   def test_def_erb_method
Index: test/cgi/test_cgi_modruby.rb
===================================================================
--- test/cgi/test_cgi_modruby.rb	(revision 36693)
+++ test/cgi/test_cgi_modruby.rb	(revision 36694)
@@ -71,7 +71,7 @@
       'status'   => '200 OK',
       '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(302, req.status)
     assert_equal('http://www.example.com/', req.headers_out['location'])
@@ -113,6 +113,7 @@
       def hash.add(name, value)
         (self[name] ||= []) << value
       end
+      @http_header = nil
       @headers_out  = hash
       @status_line  = nil
       @status       = nil
Index: test/cgi/test_cgi_multipart.rb
===================================================================
--- test/cgi/test_cgi_multipart.rb	(revision 36693)
+++ test/cgi/test_cgi_multipart.rb	(revision 36694)
@@ -119,7 +119,7 @@
 
   def _prepare(data)
     ## create multipart input
-    multipart = MultiPart.new(@boundary)
+    multipart = MultiPart.new(defined?(@boundary) ? @boundary : nil)
     data.each do |hash|
       multipart.append(hash[:name], hash[:value], hash[:filename])
     end
@@ -141,7 +141,7 @@
 
   def _test_multipart
     caller(0).find {|s| s =~ /in `test_(.*?)'/ }
-    testname = $1
+    #testname = $1
     #$stderr.puts "*** debug: testname=#{testname.inspect}"
     _prepare(@data)
     cgi = RUBY_VERSION>="1.9" ? CGI.new(:accept_charset=>"UTF-8") : CGI.new
@@ -270,7 +270,7 @@
       input2
     end
     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
     assert_equal("bad content body", ex.message)
     #
@@ -281,7 +281,7 @@
       input2
     end
     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
     assert_equal("bad content body", ex.message)
   end
Index: test/cgi/test_cgi_session.rb
===================================================================
--- test/cgi/test_cgi_session.rb	(revision 36693)
+++ test/cgi/test_cgi_session.rb	(revision 36694)
@@ -110,7 +110,7 @@
     assert_equal(value1,session["key1"])
     assert_equal(value2,session["key2"])
     assert_equal("foo",session.session_id)
-    session_id=session.session_id
+    #session_id=session.session_id
     session.close
     $stdout = StringIO.new
     cgi.out{""}
Index: test/cgi/test_cgi_header.rb
===================================================================
--- test/cgi/test_cgi_header.rb	(revision 36693)
+++ test/cgi/test_cgi_header.rb	(revision 36694)
@@ -77,7 +77,7 @@
     else
       expected = NoMethodError   # for Ruby1.8
     end
-    ex = assert_raise(expected) do
+    assert_raise(expected) do
       cgi.header(nil)
     end
   end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]