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

ruby-changes:22066

From: nobu <ko1@a...>
Date: Sat, 24 Dec 2011 07:00:14 +0900 (JST)
Subject: [ruby-changes:22066] nobu:r34115 (trunk): * test/readline/test_readline.rb (test_line_buffer__point): use

nobu	2011-12-24 06:59:54 +0900 (Sat, 24 Dec 2011)

  New Revision: 34115

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

  Log:
    * test/readline/test_readline.rb (test_line_buffer__point): use
      lambda not to exit entire method by "return".  or "next" for
      proc.  [ruby-dev:45042] [Bug #5802]

  Modified files:
    trunk/ChangeLog
    trunk/test/readline/test_readline.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 34114)
+++ ChangeLog	(revision 34115)
@@ -1,3 +1,9 @@
+Sat Dec 24 06:59:49 2011  Nobuyoshi Nakada  <nobu@r...>
+
+	* test/readline/test_readline.rb (test_line_buffer__point): use
+	  lambda not to exit entire method by "return".  or "next" for
+	  proc.  [ruby-dev:45042] [Bug #5802]
+
 Sat Dec 24 01:20:39 2011  Kazuki Tsujimoto  <kazuki@c...>
 
 	* vm_eval.c (send_internal): PASS_PASSED_BLOCK_TH must be placed
Index: test/readline/test_readline.rb
===================================================================
--- test/readline/test_readline.rb	(revision 34114)
+++ test/readline/test_readline.rb	(revision 34115)
@@ -136,22 +136,42 @@
         actual_text = nil
         actual_line_buffer = nil
         actual_point = nil
-        Readline.completion_proc = proc { |text|
+        Readline.completion_proc = ->(text) {
           actual_text = text
           actual_point = Readline.point
-          actual_buffer_line = Readline.line_buffer
+          actual_line_buffer = Readline.line_buffer
           stdin.write(" finish\n")
           stdin.close
           stdout.close
           return ["complete"]
         }
+
         stdin.write("first second\t")
         stdin.flush
+        Readline.completion_append_character = " "
         line = replace_stdio(stdin.path, stdout.path) {
           Readline.readline("> ", false)
         }
+        assert_equal("second", actual_text)
         assert_equal("first second", actual_line_buffer)
         assert_equal(12, actual_point)
+        assert_equal("first complete  finish", Readline.line_buffer)
+        assert_equal(Encoding.find("locale"), Readline.line_buffer.encoding)
+        assert_equal(true, Readline.line_buffer.tainted?)
+        assert_equal(22, Readline.point)
+
+        stdin.open
+        stdout.open
+
+        stdin.write("first second\t")
+        stdin.flush
+        Readline.completion_append_character = nil
+        line = replace_stdio(stdin.path, stdout.path) {
+          Readline.readline("> ", false)
+        }
+        assert_equal("second", actual_text)
+        assert_equal("first second", actual_line_buffer)
+        assert_equal(12, actual_point)
         assert_equal("first complete finish", Readline.line_buffer)
         assert_equal(Encoding.find("locale"), Readline.line_buffer.encoding)
         assert_equal(true, Readline.line_buffer.tainted?)

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

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