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

ruby-changes:44314

From: nobu <ko1@a...>
Date: Mon, 10 Oct 2016 15:14:11 +0900 (JST)
Subject: [ruby-changes:44314] nobu:r56387 (trunk): test_require.rb: use assert_separately

nobu	2016-10-10 15:14:07 +0900 (Mon, 10 Oct 2016)

  New Revision: 56387

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56387

  Log:
    test_require.rb: use assert_separately
    
    * test/ruby/test_require.rb (test_loading_fifo_threading_raise):
      use assert_separately.
    
    * test/ruby/test_require.rb (test_loading_fifo_threading_success):
      ditto.

  Modified files:
    trunk/test/ruby/test_require.rb
Index: test/ruby/test_require.rb
===================================================================
--- test/ruby/test_require.rb	(revision 56386)
+++ test/ruby/test_require.rb	(revision 56387)
@@ -720,14 +720,14 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L720
       f.close
       File.unlink(f.path)
       File.mkfifo(f.path)
-      assert_ruby_status(["-", f.path], <<-END, timeout: 3)
-      th = Thread.current
-      Thread.start {begin sleep(0.001) end until th.stop?; th.raise(IOError)}
-      begin
-        load(ARGV[0])
-      rescue IOError
-      end
-      END
+      assert_separately(["-", f.path], "#{<<-"begin;"}\n#{<<-"end;"}", timeout: 3)
+      begin;
+        th = Thread.current
+        Thread.start {begin sleep(0.001) end until th.stop?; th.raise(IOError)}
+        assert_raise(IOError) do
+          load(ARGV[0])
+        end
+      end;
     }
   end if File.respond_to?(:mkfifo)
 
@@ -737,20 +737,23 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L737
       File.unlink(f.path)
       File.mkfifo(f.path)
 
-      assert_ruby_status(["-", f.path], <<-INPUT, timeout: 3)
-      path = ARGV[0]
-      th = Thread.current
-      Thread.start {
-        begin
-          sleep(0.001)
-        end until th.stop?
-        open(path, File::WRONLY | File::NONBLOCK) {|fifo_w|
-          fifo_w.print "__END__\n" # ensure finishing
+      assert_separately(["-", f.path], "#{<<-"begin;"}\n#{<<-"end;"}", timeout: 3)
+      begin;
+        path = ARGV[0]
+        th = Thread.current
+        $ok = false
+        Thread.start {
+          begin
+            sleep(0.001)
+          end until th.stop?
+          open(path, File::WRONLY | File::NONBLOCK) {|fifo_w|
+            fifo_w.print "$ok = true\n__END__\n" # ensure finishing
+          }
         }
-      }
 
-      load(path)
-    INPUT
+        load(path)
+        assert($ok)
+      end;
     }
   end if File.respond_to?(:mkfifo)
 

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

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