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

ruby-changes:8257

From: akr <ko1@a...>
Date: Tue, 14 Oct 2008 23:08:42 +0900 (JST)
Subject: [ruby-changes:8257] Ruby:r19785 (trunk): add test for %B.

akr	2008-10-14 23:08:36 +0900 (Tue, 14 Oct 2008)

  New Revision: 19785

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

  Log:
    add test for %B.

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

Index: test/ruby/test_sprintf_comb.rb
===================================================================
--- test/ruby/test_sprintf_comb.rb	(revision 19784)
+++ test/ruby/test_sprintf_comb.rb	(revision 19785)
@@ -131,6 +131,11 @@
     zr = nil if mi && zr
 
     case type
+    when 'B'
+      radix = 2
+      digitmap = {0 => '0', 1 => '1'}
+      complement = !pl && !sp
+      prefix = '0B' if hs && v != 0
     when 'b'
       radix = 2
       digitmap = {0 => '0', 1 => '1'}
@@ -265,7 +270,7 @@
 
   def test_format_integer
     combination(
-        %w[b d o X x],
+        %w[B b d o X x],
         [nil, 0, 5, 20],
         ["", ".", ".0", ".8", ".20"],
         ['', ' '],

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

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