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

ruby-changes:26694

From: glass <ko1@a...>
Date: Wed, 9 Jan 2013 13:26:27 +0900 (JST)
Subject: [ruby-changes:26694] glass:r38745 (trunk): * test/ruby/test_require.rb: improve test for r38744.

glass	2013-01-09 13:26:15 +0900 (Wed, 09 Jan 2013)

  New Revision: 38745

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

  Log:
    * test/ruby/test_require.rb: improve test for r38744.
      fix to use Tempfile instead of temporary file in current directory.
      the patch is from nobu (Nobuyoshi Nakada).

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/test_require.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 38744)
+++ ChangeLog	(revision 38745)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jan  9 13:20:23 2013  Masaki Matsushita  <glass.saga@g...>
+
+	* test/ruby/test_require.rb: improve test for r38744.
+	  fix to use Tempfile instead of temporary file in current directory.
+	  the patch is from nobu (Nobuyoshi Nakada).
+
 Wed Jan  9 09:53:23 2013  Masaki Matsushita  <glass.saga@g...>
 
 	* load.c (load_lock): fix not to delete thread shield twice.
Index: test/ruby/test_require.rb
===================================================================
--- test/ruby/test_require.rb	(revision 38744)
+++ test/ruby/test_require.rb	(revision 38745)
@@ -607,22 +607,26 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L607
 
   def test_require_with_loaded_features_pop
     bug7530 = '[ruby-core:50645]'
-    assert_in_out_err([], <<-INPUT, %w(:ok), [], bug7530)
+    script = Tempfile.new(%w'bug-7530- .rb')
+    script.close
+    dir, base = File.split(script.path)
+    assert_in_out_err(["-C", dir, "-", base], <<-INPUT, %w(:ok), [], bug7530)
+      PATH = ARGV.shift
       THREADS = 2
       ITERATIONS_PER_THREAD = 1000
 
       $: << '.'
-      system 'touch __load_path_bench_script__.rb'
       THREADS.times.map {
         Thread.new do
           ITERATIONS_PER_THREAD.times do
-            require '__load_path_bench_script__'
+            require PATH
             $".pop
           end
         end
       }.each(&:join)
-      system 'rm __load_path_bench_script__.rb'
       p :ok
     INPUT
+  ensure
+    script.close(true) if script
   end
 end

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

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