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

ruby-changes:9523

From: yugui <ko1@a...>
Date: Fri, 26 Dec 2008 14:54:58 +0900 (JST)
Subject: [ruby-changes:9523] Ruby:r21065 (ruby_1_9_1): merges r20984 from trunk. c.f.

yugui	2008-12-26 14:54:48 +0900 (Fri, 26 Dec 2008)

  New Revision: 21065

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

  Log:
    merges r20984 from trunk. c.f. [ruby-dev:37240]
    * test/ruby/test_eval.rb: add new test.

  Modified files:
    branches/ruby_1_9_1/test/ruby/test_eval.rb

Index: ruby_1_9_1/test/ruby/test_eval.rb
===================================================================
--- ruby_1_9_1/test/ruby/test_eval.rb	(revision 21064)
+++ ruby_1_9_1/test/ruby/test_eval.rb	(revision 21065)
@@ -1,4 +1,5 @@
 require 'test/unit'
+require_relative 'envutil'
 
 class TestEval < Test::Unit::TestCase
 
@@ -7,6 +8,15 @@
   $gvar__eval = 14
   Const = 15
 
+  def ruby(*args)
+    args = ['-e', '$>.write($<.read)'] if args.empty?
+    ruby = EnvUtil.rubybin
+    f = IO.popen([ruby] + args, 'r+')
+    yield(f)
+  ensure
+    f.close unless !f || f.closed?
+  end
+
   def test_eval_basic
     assert_equal nil,   eval("nil")
     assert_equal true,  eval("true")
@@ -391,4 +401,11 @@
       end.join
     end
   end
+
+  def test_eval_with_toplevel_binding # [ruby-dev:37142]
+    ruby("-e", "x = 0; eval('p x', TOPLEVEL_BINDING)") do |f|
+      f.close_write
+      assert_equal("0", f.read.chomp)
+    end
+  end
 end

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

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