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

ruby-changes:61347

From: Hiroshi <ko1@a...>
Date: Sat, 23 May 2020 16:45:23 +0900 (JST)
Subject: [ruby-changes:61347] d48c92aa04 (master): Rename TestScheduler* to TestFiber for convention of the test directory

https://git.ruby-lang.org/ruby.git/commit/?id=d48c92aa04

From d48c92aa04ffd3a1cecef599eaa5e4409aab2fe4 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Sat, 23 May 2020 16:43:58 +0900
Subject: Rename TestScheduler* to TestFiber for convention of the test
 directory


diff --git a/test/fiber/test_enumerator.rb b/test/fiber/test_enumerator.rb
index 7c97382..6679d9e 100644
--- a/test/fiber/test_enumerator.rb
+++ b/test/fiber/test_enumerator.rb
@@ -3,7 +3,7 @@ require 'test/unit' https://github.com/ruby/ruby/blob/trunk/test/fiber/test_enumerator.rb#L3
 require 'socket'
 require_relative 'scheduler'
 
-class TestSchedulerEnumerator < Test::Unit::TestCase
+class TestFiberEnumerator < Test::Unit::TestCase
   MESSAGE = "Hello World"
 
   def test_read_characters
diff --git a/test/fiber/test_fiber.rb b/test/fiber/test_fiber.rb
deleted file mode 100644
index 3680650..0000000
--- a/test/fiber/test_fiber.rb
+++ /dev/null
@@ -1,29 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/test/fiber/test_enumerator.rb#L0
-# frozen_string_literal: true
-require 'test/unit'
-require_relative 'scheduler'
-
-class TestSchedulerFiber < Test::Unit::TestCase
-  def test_fiber_without_scheduler
-    # Cannot create fiber without scheduler.
-    assert_raise RuntimeError do
-      Fiber do
-      end
-    end
-  end
-
-  def test_fiber_blocking
-    scheduler = Scheduler.new
-
-    thread = Thread.new do
-      Thread.current.scheduler = scheduler
-
-      # Close is always a blocking operation.
-      IO.pipe.each(&:close)
-    end
-
-    thread.join
-
-    assert_not_empty scheduler.blocking
-    assert_match(/test_fiber\.rb:\d+:in `close'/, scheduler.blocking.last)
-  end
-end
diff --git a/test/fiber/test_http.rb b/test/fiber/test_http.rb
index 82aa73c..02e44d7 100644
--- a/test/fiber/test_http.rb
+++ b/test/fiber/test_http.rb
@@ -7,7 +7,7 @@ require 'openssl' https://github.com/ruby/ruby/blob/trunk/test/fiber/test_http.rb#L7
 require 'test/unit'
 require_relative 'scheduler'
 
-class TestSchedulerHTTP < Test::Unit::TestCase
+class TestFiberHTTP < Test::Unit::TestCase
   def test_get
     Thread.new do
       scheduler = Scheduler.new
diff --git a/test/fiber/test_io.rb b/test/fiber/test_io.rb
index ef46d1a..e7f06f7 100644
--- a/test/fiber/test_io.rb
+++ b/test/fiber/test_io.rb
@@ -2,7 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/test/fiber/test_io.rb#L2
 require 'test/unit'
 require_relative 'scheduler'
 
-class TestSchedulerIO < Test::Unit::TestCase
+class TestFiberIO < Test::Unit::TestCase
   MESSAGE = "Hello World"
 
   def test_read
diff --git a/test/fiber/test_mutex.rb b/test/fiber/test_mutex.rb
index 2ffe019..c4e671f 100644
--- a/test/fiber/test_mutex.rb
+++ b/test/fiber/test_mutex.rb
@@ -2,7 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/test/fiber/test_mutex.rb#L2
 require 'test/unit'
 require_relative 'scheduler'
 
-class TestSchedulerMutex < Test::Unit::TestCase
+class TestFiberMutex < Test::Unit::TestCase
   def test_mutex_synchronize
     mutex = Mutex.new
 
diff --git a/test/fiber/test_scheduler.rb b/test/fiber/test_scheduler.rb
new file mode 100644
index 0000000..f3ea6e8
--- /dev/null
+++ b/test/fiber/test_scheduler.rb
@@ -0,0 +1,29 @@ https://github.com/ruby/ruby/blob/trunk/test/fiber/test_scheduler.rb#L1
+# frozen_string_literal: true
+require 'test/unit'
+require_relative 'scheduler'
+
+class TestFiberScheduler < Test::Unit::TestCase
+  def test_fiber_without_scheduler
+    # Cannot create fiber without scheduler.
+    assert_raise RuntimeError do
+      Fiber do
+      end
+    end
+  end
+
+  def test_fiber_blocking
+    scheduler = Scheduler.new
+
+    thread = Thread.new do
+      Thread.current.scheduler = scheduler
+
+      # Close is always a blocking operation.
+      IO.pipe.each(&:close)
+    end
+
+    thread.join
+
+    assert_not_empty scheduler.blocking
+    assert_match(/test_fiber\.rb:\d+:in `close'/, scheduler.blocking.last)
+  end
+end
diff --git a/test/fiber/test_sleep.rb b/test/fiber/test_sleep.rb
index 0be7603..bfb892e 100644
--- a/test/fiber/test_sleep.rb
+++ b/test/fiber/test_sleep.rb
@@ -2,7 +2,7 @@ https://github.com/ruby/ruby/blob/trunk/test/fiber/test_sleep.rb#L2
 require 'test/unit'
 require_relative 'scheduler'
 
-class TestSchedulerSleep < Test::Unit::TestCase
+class TestFiberSleep < Test::Unit::TestCase
   ITEMS = [0, 1, 2, 3, 4]
 
   def test_sleep
-- 
cgit v0.10.2


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

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