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

ruby-changes:62319

From: Samuel <ko1@a...>
Date: Mon, 20 Jul 2020 10:21:18 +0900 (JST)
Subject: [ruby-changes:62319] e6e9cef06e (master): Improve consistency of tests.

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

From e6e9cef06e9023a80991518297d9f2c0c12488ce Mon Sep 17 00:00:00 2001
From: Samuel Williams <samuel.williams@o...>
Date: Thu, 16 Jul 2020 15:19:47 +1200
Subject: Improve consistency of tests.


diff --git a/test/fiber/scheduler.rb b/test/fiber/scheduler.rb
index 820f441..7404966 100644
--- a/test/fiber/scheduler.rb
+++ b/test/fiber/scheduler.rb
@@ -1,6 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/test/fiber/scheduler.rb#L1
 # frozen_string_literal: true
 
 require 'fiber'
+require 'socket'
 
 begin
   require 'io/nonblock'
diff --git a/test/fiber/test_enumerator.rb b/test/fiber/test_enumerator.rb
index d332726..f88657c 100644
--- a/test/fiber/test_enumerator.rb
+++ b/test/fiber/test_enumerator.rb
@@ -1,19 +1,19 @@ https://github.com/ruby/ruby/blob/trunk/test/fiber/test_enumerator.rb#L1
 # frozen_string_literal: true
 require 'test/unit'
-require 'socket'
 require_relative 'scheduler'
 
 class TestFiberEnumerator < Test::Unit::TestCase
   MESSAGE = "Hello World"
 
   def test_read_characters
-    skip unless defined?(UNIXSocket)
+    skip "UNIXSocket is not defined!" unless defined?(UNIXSocket)
 
     i, o = UNIXSocket.pair
+
     unless i.nonblock? && o.nonblock?
       i.close
       o.close
-      skip
+      skip "I/O is not non-blocking!"
     end
 
     message = String.new
diff --git a/test/fiber/test_io.rb b/test/fiber/test_io.rb
index e7f06f7..bf20006 100644
--- a/test/fiber/test_io.rb
+++ b/test/fiber/test_io.rb
@@ -6,10 +6,15 @@ class TestFiberIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/fiber/test_io.rb#L6
   MESSAGE = "Hello World"
 
   def test_read
-    skip unless defined?(UNIXSocket)
+    skip "UNIXSocket is not defined!" unless defined?(UNIXSocket)
 
     i, o = UNIXSocket.pair
-    skip unless i.nonblock? && o.nonblock?
+
+    unless i.nonblock? && o.nonblock?
+      i.close
+      o.close
+      skip "I/O is not non-blocking!"
+    end
 
     message = nil
 
@@ -31,5 +36,7 @@ class TestFiberIO < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/fiber/test_io.rb#L36
     thread.join
 
     assert_equal MESSAGE, message
+    assert_predicate(i, :closed?)
+    assert_predicate(o, :closed?)
   end
 end
-- 
cgit v0.10.2


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

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