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

ruby-changes:25251

From: tenderlove <ko1@a...>
Date: Wed, 24 Oct 2012 02:46:43 +0900 (JST)
Subject: [ruby-changes:25251] tenderlove:r37303 (trunk): Add test for instance_exec receiving a curried proc.

tenderlove	2012-10-24 02:46:33 +0900 (Wed, 24 Oct 2012)

  New Revision: 37303

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

  Log:
    Add test for instance_exec receiving a curried proc.

  Modified files:
    trunk/test/ruby/test_proc.rb

Index: test/ruby/test_proc.rb
===================================================================
--- test/ruby/test_proc.rb	(revision 37302)
+++ test/ruby/test_proc.rb	(revision 37303)
@@ -261,6 +261,15 @@
       end, 'moved from btest/knownbug, [ruby-core:15551]')
   end
 
+  def test_curry_instance_exec
+    a = lambda { |x, y| [x + y, self] }
+    b = a.curry.call(1)
+    result = instance_exec 2, &b
+
+    assert_equal(3, result[0])
+    assert_equal(self, result[1])
+  end
+
   def test_dup_clone
     b = proc {|x| x + "bar" }
     class << b; attr_accessor :foo; end

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

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