mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* test/ruby/test_require.rb: Remove temporally files in the tests.
* test/ruby/test_rubyoptions.rb: Ditto. * test/logger/test_logger.rb: Ditto. * test/psych/test_psych.rb: Ditto. * test/readline/test_readline.rb: Ditto. * test/syslog/test_syslog_logger.rb: Ditto. * test/webrick/test_httpauth.rb: Ditto. * test/zlib/test_zlib.rb: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									61f50e317e
								
							
						
					
					
						commit
						052c0e67d9
					
				
					 9 changed files with 64 additions and 3 deletions
				
			
		
							
								
								
									
										18
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										18
									
								
								ChangeLog
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,3 +1,21 @@
 | 
			
		|||
Sun Mar 24 11:03:31 2013  Tanaka Akira  <akr@fsij.org>
 | 
			
		||||
 | 
			
		||||
	* test/ruby/test_require.rb: Remove temporally files in the tests.
 | 
			
		||||
 | 
			
		||||
	* test/ruby/test_rubyoptions.rb: Ditto.
 | 
			
		||||
 | 
			
		||||
	* test/logger/test_logger.rb: Ditto.
 | 
			
		||||
 | 
			
		||||
	* test/psych/test_psych.rb: Ditto.
 | 
			
		||||
 | 
			
		||||
	* test/readline/test_readline.rb: Ditto.
 | 
			
		||||
 | 
			
		||||
	* test/syslog/test_syslog_logger.rb: Ditto.
 | 
			
		||||
 | 
			
		||||
	* test/webrick/test_httpauth.rb: Ditto.
 | 
			
		||||
 | 
			
		||||
	* test/zlib/test_zlib.rb: Ditto.
 | 
			
		||||
 | 
			
		||||
Sun Mar 24 05:36:29 2013  Eric Hodel  <drbrain@segment7.net>
 | 
			
		||||
 | 
			
		||||
	* lib/rinda/ring.rb:  Added documentation for multicast support.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ class TestLogger < Test::Unit::TestCase
 | 
			
		|||
    logger.__send__(msg_id, *arg, &block)
 | 
			
		||||
    logdev.open
 | 
			
		||||
    msg = logdev.read
 | 
			
		||||
    logdev.close
 | 
			
		||||
    logdev.close(true)
 | 
			
		||||
    msg
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,6 +68,7 @@ class TestPsych < Psych::TestCase
 | 
			
		|||
      assert_equal io, Psych.dump(hash, io)
 | 
			
		||||
      io.rewind
 | 
			
		||||
      assert_equal Psych.dump(hash), io.read
 | 
			
		||||
      io.close(true)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -396,6 +396,8 @@ class TestReadline < Test::Unit::TestCase
 | 
			
		|||
        Readline.pre_input_hook = nil
 | 
			
		||||
      rescue NotImplementedError
 | 
			
		||||
      end
 | 
			
		||||
      stdin.close(true)
 | 
			
		||||
      stdout.close(true)
 | 
			
		||||
    end
 | 
			
		||||
  end if !/EditLine|\A4\.3\z/n.match(Readline::VERSION)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,7 @@ class TestRequire < Test::Unit::TestCase
 | 
			
		|||
        p :ok
 | 
			
		||||
      end
 | 
			
		||||
    INPUT
 | 
			
		||||
    t.close(true)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_require_too_long_filename
 | 
			
		||||
| 
						 | 
				
			
			@ -101,6 +102,7 @@ class TestRequire < Test::Unit::TestCase
 | 
			
		|||
  ensure
 | 
			
		||||
    env_rubypath ? ENV["RUBYPATH"] = env_rubypath : ENV.delete("RUBYPATH")
 | 
			
		||||
    env_home ? ENV["HOME"] = env_home : ENV.delete("HOME")
 | 
			
		||||
    t.close(true)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_require_with_unc
 | 
			
		||||
| 
						 | 
				
			
			@ -258,6 +260,7 @@ class TestRequire < Test::Unit::TestCase
 | 
			
		|||
    INPUT
 | 
			
		||||
 | 
			
		||||
    assert_raise(ArgumentError) { at_exit }
 | 
			
		||||
    t.close(true)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_load2  # [ruby-core:25039]
 | 
			
		||||
| 
						 | 
				
			
			@ -271,6 +274,7 @@ class TestRequire < Test::Unit::TestCase
 | 
			
		|||
    assert_in_out_err([], <<-INPUT, %w("hello"), [])
 | 
			
		||||
      load(#{ t.path.dump }, true)
 | 
			
		||||
    INPUT
 | 
			
		||||
    t.close(true)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_tainted_loadpath
 | 
			
		||||
| 
						 | 
				
			
			@ -320,6 +324,8 @@ class TestRequire < Test::Unit::TestCase
 | 
			
		|||
      require "#{ file }"
 | 
			
		||||
      p :ok
 | 
			
		||||
    INPUT
 | 
			
		||||
 | 
			
		||||
    t.close(true)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_relative
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -528,7 +528,7 @@ class TestRubyOptions < Test::Unit::TestCase
 | 
			
		|||
    t.flush
 | 
			
		||||
    assert_in_out_err(["-e", "$0=ARGV[0]; Process.kill :SEGV, $$", t.path],
 | 
			
		||||
                      "", [], expected_stderr, bug7597, opts)
 | 
			
		||||
    t.close
 | 
			
		||||
    t.close(true)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_DATA
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -85,7 +85,7 @@ class TestSyslogRootLogger < Test::Unit::TestCase
 | 
			
		|||
    assert_equal true, @logger.__send__(msg_id, *arg, &block)
 | 
			
		||||
    logdev.open
 | 
			
		||||
    msg = logdev.read
 | 
			
		||||
    logdev.close
 | 
			
		||||
    logdev.close(true)
 | 
			
		||||
    msg
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -59,6 +59,7 @@ class TestWEBrickHTTPAuth < Test::Unit::TestCase
 | 
			
		|||
      http.request(g){|res| assert_equal("hoge", res.body, log.call)}
 | 
			
		||||
      g.basic_auth("webrick", "not super")
 | 
			
		||||
      http.request(g){|res| assert_not_equal("hoge", res.body, log.call)}
 | 
			
		||||
      tmpfile.close(true)
 | 
			
		||||
    }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -140,6 +141,7 @@ class TestWEBrickHTTPAuth < Test::Unit::TestCase
 | 
			
		|||
        g['Authorization'] = credentials_for_request('webrick', "not super", params)
 | 
			
		||||
        http.request(g){|res| assert_not_equal("hoge", res.body, log.call)}
 | 
			
		||||
      end
 | 
			
		||||
      tmpfile.close(true)
 | 
			
		||||
    }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -439,6 +439,7 @@ if defined? Zlib
 | 
			
		|||
      Zlib::GzipReader.open(t.path) do |f|
 | 
			
		||||
        assert_kind_of(IO, f.to_io)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_crc
 | 
			
		||||
| 
						 | 
				
			
			@ -450,6 +451,7 @@ if defined? Zlib
 | 
			
		|||
        f.read
 | 
			
		||||
        assert_equal(0x8c736521, f.crc)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_mtime
 | 
			
		||||
| 
						 | 
				
			
			@ -468,6 +470,7 @@ if defined? Zlib
 | 
			
		|||
      Zlib::GzipReader.open(t.path) do |f|
 | 
			
		||||
        assert_equal(tim.to_i, f.mtime.to_i)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_level
 | 
			
		||||
| 
						 | 
				
			
			@ -478,6 +481,7 @@ if defined? Zlib
 | 
			
		|||
      Zlib::GzipReader.open(t.path) do |f|
 | 
			
		||||
        assert_equal(Zlib::DEFAULT_COMPRESSION, f.level)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_os_code
 | 
			
		||||
| 
						 | 
				
			
			@ -488,6 +492,7 @@ if defined? Zlib
 | 
			
		|||
      Zlib::GzipReader.open(t.path) do |f|
 | 
			
		||||
        assert_equal(Zlib::OS_CODE, f.os_code)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_orig_name
 | 
			
		||||
| 
						 | 
				
			
			@ -503,6 +508,7 @@ if defined? Zlib
 | 
			
		|||
      Zlib::GzipReader.open(t.path) do |f|
 | 
			
		||||
        assert_equal("foobarbazqux", f.orig_name)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_comment
 | 
			
		||||
| 
						 | 
				
			
			@ -518,6 +524,7 @@ if defined? Zlib
 | 
			
		|||
      Zlib::GzipReader.open(t.path) do |f|
 | 
			
		||||
        assert_equal("foobarbazqux", f.comment)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_lineno
 | 
			
		||||
| 
						 | 
				
			
			@ -532,6 +539,7 @@ if defined? Zlib
 | 
			
		|||
        assert_equal([1000, "baz\n"], [f.lineno, f.gets])
 | 
			
		||||
        assert_equal([1001, "qux\n"], [f.lineno, f.gets])
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_closed_p
 | 
			
		||||
| 
						 | 
				
			
			@ -546,6 +554,7 @@ if defined? Zlib
 | 
			
		|||
        f.close
 | 
			
		||||
        assert_equal(true, f.closed?)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_sync
 | 
			
		||||
| 
						 | 
				
			
			@ -560,6 +569,7 @@ if defined? Zlib
 | 
			
		|||
        f.sync = false
 | 
			
		||||
        assert_equal(false, f.sync)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_pos
 | 
			
		||||
| 
						 | 
				
			
			@ -570,6 +580,7 @@ if defined? Zlib
 | 
			
		|||
        gz.flush
 | 
			
		||||
        assert_equal(3, gz.tell)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_path
 | 
			
		||||
| 
						 | 
				
			
			@ -599,6 +610,7 @@ if defined? Zlib
 | 
			
		|||
      Zlib::GzipReader.new(sio) do |f|
 | 
			
		||||
        assert_raise(NoMethodError) { f.path }
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -670,6 +682,7 @@ if defined? Zlib
 | 
			
		|||
      ensure
 | 
			
		||||
        f.close
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_rewind
 | 
			
		||||
| 
						 | 
				
			
			@ -682,6 +695,7 @@ if defined? Zlib
 | 
			
		|||
        f.rewind
 | 
			
		||||
        assert_equal("foo", f.read)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_unused
 | 
			
		||||
| 
						 | 
				
			
			@ -696,6 +710,7 @@ if defined? Zlib
 | 
			
		|||
        assert_equal("bar", f.read)
 | 
			
		||||
        assert_equal(nil, f.unused)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_unused2
 | 
			
		||||
| 
						 | 
				
			
			@ -735,6 +750,7 @@ if defined? Zlib
 | 
			
		|||
        assert_raise(ArgumentError) { f.read(-1) }
 | 
			
		||||
        assert_equal(str, f.read)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_readpartial
 | 
			
		||||
| 
						 | 
				
			
			@ -753,6 +769,7 @@ if defined? Zlib
 | 
			
		|||
 | 
			
		||||
        assert_raise(ArgumentError) { f.readpartial(-1) }
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_getc
 | 
			
		||||
| 
						 | 
				
			
			@ -764,6 +781,7 @@ if defined? Zlib
 | 
			
		|||
        "foobar".each_char {|c| assert_equal(c, f.getc) }
 | 
			
		||||
        assert_nil(f.getc)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_getbyte
 | 
			
		||||
| 
						 | 
				
			
			@ -775,6 +793,7 @@ if defined? Zlib
 | 
			
		|||
        "foobar".each_byte {|c| assert_equal(c, f.getbyte) }
 | 
			
		||||
        assert_nil(f.getbyte)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_readchar
 | 
			
		||||
| 
						 | 
				
			
			@ -786,6 +805,7 @@ if defined? Zlib
 | 
			
		|||
        "foobar".each_byte {|c| assert_equal(c, f.readchar.ord) }
 | 
			
		||||
        assert_raise(EOFError) { f.readchar }
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_each_byte
 | 
			
		||||
| 
						 | 
				
			
			@ -798,6 +818,7 @@ if defined? Zlib
 | 
			
		|||
        f.each_byte {|c| a << c }
 | 
			
		||||
        assert_equal("foobar".each_byte.to_a, a)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_gets
 | 
			
		||||
| 
						 | 
				
			
			@ -823,6 +844,7 @@ if defined? Zlib
 | 
			
		|||
        assert_equal("az\n", f.gets(nil, 10))
 | 
			
		||||
        assert_nil(f.gets)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_gets2
 | 
			
		||||
| 
						 | 
				
			
			@ -849,6 +871,7 @@ if defined? Zlib
 | 
			
		|||
        assert_equal(ustrs[2][1..-1], f.gets(nil, 20))
 | 
			
		||||
        assert_nil(f.gets)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_readline
 | 
			
		||||
| 
						 | 
				
			
			@ -862,6 +885,7 @@ if defined? Zlib
 | 
			
		|||
        assert_equal("baz\n", f.readline)
 | 
			
		||||
        assert_raise(EOFError) { f.readline }
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_each
 | 
			
		||||
| 
						 | 
				
			
			@ -873,6 +897,7 @@ if defined? Zlib
 | 
			
		|||
        a = ["foo\n", "bar\n", "baz\n"]
 | 
			
		||||
        f.each {|l| assert_equal(a.shift, l) }
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_readlines
 | 
			
		||||
| 
						 | 
				
			
			@ -883,6 +908,7 @@ if defined? Zlib
 | 
			
		|||
      Zlib::GzipReader.open(t.path) do |f|
 | 
			
		||||
        assert_equal(["foo\n", "bar\n", "baz\n"], f.readlines)
 | 
			
		||||
      end
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_reader_wrap
 | 
			
		||||
| 
						 | 
				
			
			@ -893,6 +919,7 @@ if defined? Zlib
 | 
			
		|||
      f.binmode
 | 
			
		||||
      assert_equal("foo", Zlib::GzipReader.wrap(f) {|gz| gz.read })
 | 
			
		||||
      assert_raise(IOError) { f.close }
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_corrupted_header
 | 
			
		||||
| 
						 | 
				
			
			@ -923,6 +950,7 @@ if defined? Zlib
 | 
			
		|||
      read_size = Zlib::GzipReader.open(t.path) {|gz| gz.read(1024) }
 | 
			
		||||
      assert_equal(Encoding::ASCII_8BIT, read_size.encoding)
 | 
			
		||||
      assert_equal(content, read_size)
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -951,6 +979,7 @@ if defined? Zlib
 | 
			
		|||
      assert_equal("bar", Zlib::GzipReader.open(t.path) {|gz| gz.read })
 | 
			
		||||
 | 
			
		||||
      assert_raise(Zlib::StreamError) { Zlib::GzipWriter.open(t.path, 10000) }
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_write
 | 
			
		||||
| 
						 | 
				
			
			@ -963,6 +992,7 @@ if defined? Zlib
 | 
			
		|||
      def o.to_s; "bar"; end
 | 
			
		||||
      Zlib::GzipWriter.open(t.path) {|gz| gz.print(o) }
 | 
			
		||||
      assert_equal("bar", Zlib::GzipReader.open(t.path) {|gz| gz.read })
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_putc
 | 
			
		||||
| 
						 | 
				
			
			@ -972,6 +1002,7 @@ if defined? Zlib
 | 
			
		|||
      assert_equal("x", Zlib::GzipReader.open(t.path) {|gz| gz.read })
 | 
			
		||||
 | 
			
		||||
      # todo: multibyte char
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def test_writer_wrap
 | 
			
		||||
| 
						 | 
				
			
			@ -980,6 +1011,7 @@ if defined? Zlib
 | 
			
		|||
      Zlib::GzipWriter.wrap(t) {|gz| gz.print("foo") }
 | 
			
		||||
      t.close
 | 
			
		||||
      assert_equal("foo", Zlib::GzipReader.open(t.path) {|gz| gz.read })
 | 
			
		||||
      t.close(true)
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue