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

ruby-changes:29467

From: nobu <ko1@a...>
Date: Fri, 21 Jun 2013 14:32:58 +0900 (JST)
Subject: [ruby-changes:29467] nobu:r41519 (trunk): test_env.rb: fix test

nobu	2013-06-21 14:31:38 +0900 (Fri, 21 Jun 2013)

  New Revision: 41519

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

  Log:
    test_env.rb: fix test
    
    * test/ruby/test_env.rb (test_win32_blocksize): fix remained size, and
      delete added envvars.

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

Index: test/ruby/test_env.rb
===================================================================
--- test/ruby/test_env.rb	(revision 41518)
+++ test/ruby/test_env.rb	(revision 41519)
@@ -390,13 +390,19 @@ class TestEnv < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_env.rb#L390
 
   if /mswin|mingw/ =~ RUBY_PLATFORM
     def test_win32_blocksize
-      len = 32767 - ENV.to_a.flatten.inject(0) {|r,e| r + e.size + 2 }
+      keys = []
+      len = 32767 - ENV.to_a.flatten.inject(0) {|r,e| r + e.bytesize + 1}
       val = "bar" * 1000
       key = nil
+      while (len -= val.size + (key="foo#{len}").size + 2) > 0
+        keys << key
+        ENV[key] = val
+      end
       1.upto(12) {|i|
-        ENV[key] = val while (len -= val.size + (key="foo#{len}").size + 2) > 0
         assert_raise(Errno::EINVAL) { ENV[key] = val }
       }
+    ensure
+      keys.each {|k| ENV.delete(k)}
     end
   end
 end

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

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