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

ruby-changes:18261

From: nobu <ko1@a...>
Date: Tue, 21 Dec 2010 06:26:04 +0900 (JST)
Subject: [ruby-changes:18261] Ruby:r30284 (trunk): * test/rexml/test_contrib.rb (ContribTester#test_pos): should not

nobu	2010-12-21 06:25:49 +0900 (Tue, 21 Dec 2010)

  New Revision: 30284

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

  Log:
    * test/rexml/test_contrib.rb (ContribTester#test_pos): should not
      use fixed path name for tests.  [ruby-dev:42827]
    * test/rexml/test_sax.rb (SAX2Tester#test_socket): should not use
      fixed port for tests.  [ruby-dev:42828]

  Modified files:
    trunk/ChangeLog
    trunk/test/rexml/test_contrib.rb
    trunk/test/rexml/test_sax.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 30283)
+++ ChangeLog	(revision 30284)
@@ -1,3 +1,11 @@
+Tue Dec 21 06:25:43 2010  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/rexml/test_contrib.rb (ContribTester#test_pos): should not
+	  use fixed path name for tests.  [ruby-dev:42827]
+
+	* test/rexml/test_sax.rb (SAX2Tester#test_socket): should not use
+	  fixed port for tests.  [ruby-dev:42828]
+
 Tue Dec 21 06:10:18 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* compile.c (setup_args), vm.c (invoke_block_from_c),
Index: test/rexml/test_contrib.rb
===================================================================
--- test/rexml/test_contrib.rb	(revision 30283)
+++ test/rexml/test_contrib.rb	(revision 30284)
@@ -74,7 +74,7 @@
     EOF
     doc = REXML::Document.new source
     doc.write(out="")
-    assert(out[/>'>/] != nil, "Couldn't find >'>")
+    assert(out[/>\'>/] != nil, "Couldn't find >'>")
     assert(out[/\]>/] != nil, "Couldn't find ]>")
   end
 
@@ -512,7 +512,8 @@
   end
 
   def test_pos
-    testfile = "/tmp/tidal#{$$}"
+    require 'tempfile'
+    testfile = Tempfile.new("tidal")
     testdata = %Q{<calibration>
 <section name="parameters">
 <param name="barpress">760</param>
@@ -521,13 +522,12 @@
 </calibration>
 }
 
-    File.open(testfile, 'w') do |f|
-        f.puts testdata
+    testfile.puts testdata
+    testfile.rewind
+    assert_nothing_raised do
+      d = REXML::Document.new(testfile)
     end
-    File.open(testfile) do |f|
-        d = REXML::Document.new(f)
-    end
-    #File.unlink(testfile)
+    testfile.close(true)
   end
 
   def test_deep_clone
Index: test/rexml/test_sax.rb
===================================================================
--- test/rexml/test_sax.rb	(revision 30283)
+++ test/rexml/test_sax.rb	(revision 30284)
@@ -221,11 +221,9 @@
   def test_socket
     require 'socket'
 
-    port = 12345
+    server = TCPServer.new('127.0.0.1', 0)
+    socket = TCPSocket.new('127.0.0.1', server.addr[1])
 
-    server = TCPServer.new('127.0.0.1', port)
-    socket = TCPSocket.new('127.0.0.1', port)
-
     ok = false
     session = server.accept
     session << '<foo>'

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

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