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

ruby-changes:38045

From: nagachika <ko1@a...>
Date: Mon, 30 Mar 2015 23:41:34 +0900 (JST)
Subject: [ruby-changes:38045] nagachika:r50126 (ruby_2_1): merge revision(s) r46254, r48982, r48984: [Backport #10649]

nagachika	2015-03-30 23:41:15 +0900 (Mon, 30 Mar 2015)

  New Revision: 50126

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

  Log:
    merge revision(s) r46254,r48982,r48984: [Backport #10649]
    
    test/io/console/test_io_console.rb: Close FDs.
    
    * ext/io/console/console.c (console_dev): id_console is not a
      constant name, use rb_const_remove() to get rid of NameError.

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/ext/io/console/console.c
    branches/ruby_2_1/test/io/console/test_io_console.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 50125)
+++ ruby_2_1/ChangeLog	(revision 50126)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Mon Mar 30 23:30:57 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* ext/io/console/console.c (console_dev): id_console is not a
+	  constant name, use rb_const_remove() to get rid of NameError.
+
 Sun Mar 22 04:15:39 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* ext/thread/thread.c (Init_thread): ConditionVariable and Queue
Index: ruby_2_1/ext/io/console/console.c
===================================================================
--- ruby_2_1/ext/io/console/console.c	(revision 50125)
+++ ruby_2_1/ext/io/console/console.c	(revision 50126)
@@ -689,7 +689,7 @@ console_dev(VALUE klass) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ext/io/console/console.c#L689
 	    if ((fptr = RFILE(con)->fptr) && GetReadFD(fptr) != -1)
 		return con;
 	}
-	rb_mod_remove_const(klass, ID2SYM(id_console));
+	rb_const_remove(klass, id_console);
     }
     {
 	VALUE args[2];
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 50125)
+++ ruby_2_1/version.h	(revision 50126)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.5"
-#define RUBY_RELEASE_DATE "2015-03-24"
-#define RUBY_PATCHLEVEL 321
+#define RUBY_RELEASE_DATE "2015-03-30"
+#define RUBY_PATCHLEVEL 322
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 3
-#define RUBY_RELEASE_DAY 24
+#define RUBY_RELEASE_DAY 30
 
 #include "ruby/version.h"
 
Index: ruby_2_1/test/io/console/test_io_console.rb
===================================================================
--- ruby_2_1/test/io/console/test_io_console.rb	(revision 50125)
+++ ruby_2_1/test/io/console/test_io_console.rb	(revision 50126)
@@ -217,18 +217,22 @@ class TestIO_Console < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/io/console/test_io_console.rb#L217
   end
 
   if IO.console
+    def test_close
+      IO.console.close
+      assert_kind_of(IO, IO.console)
+      assert_nothing_raised(IOError) {IO.console.fileno}
+    end
+
     def test_sync
       assert(IO.console.sync, "console should be unbuffered")
     end
   else
+    def test_close
+      assert_equal(["true"], run_pty("IO.console.close; p IO.console.fileno >= 0"))
+    end
+
     def test_sync
-      r, w, pid = PTY.spawn(EnvUtil.rubybin, "-rio/console", "-e", "p IO.console.class")
-    rescue RuntimeError
-      skip $!
-    else
-      con = r.gets.chomp
-      Process.wait(pid)
-      assert_match("File", con)
+      assert_equal(["true"], run_pty("p IO.console.sync"))
     end
   end
 
@@ -243,6 +247,23 @@ class TestIO_Console < Test::Unit::TestC https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/io/console/test_io_console.rb#L247
     m.close if m
     s.close if s
   end
+
+  def run_pty(src)
+    r, w, pid = PTY.spawn(EnvUtil.rubybin, "-rio/console", "-e", src)
+  rescue RuntimeError
+    skip $!
+  else
+    result = r.readlines(&:chomp)
+    Process.wait(pid)
+    if block_given?
+      yield result
+    else
+      result
+    end
+  ensure
+    r.close if r
+    w.close if w
+  end
 end if defined?(PTY) and defined?(IO::console)
 
 class TestIO_Console < Test::Unit::TestCase

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r46254,48982,48984


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

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