[MacRuby] #1017: macgem intall error

MacRuby ruby-noreply at macosforge.org
Thu Dec 2 07:51:06 PST 2010


#1017: macgem intall error
----------------------------+-----------------------------------------------
 Reporter:  tglee@…         |       Owner:  lsansonetti@…        
     Type:  defect          |      Status:  new                  
 Priority:  blocker         |   Milestone:                       
Component:  MacRuby         |    Keywords:  macgem               
----------------------------+-----------------------------------------------

Comment(by watson1978@…):

 I attach a patch. Please check it.
 {{{
 #!diff
 diff --git a/ext/libyaml/rubyext.c b/ext/libyaml/rubyext.c
 index c0eaf82..76827d9 100644
 --- a/ext/libyaml/rubyext.c
 +++ b/ext/libyaml/rubyext.c
 @@ -290,6 +290,7 @@ is_numeric(const char *str, bool *has_point)
      }
      char c;
      bool point = false;
 +    bool numeric = false;
      while ((c = *str++) != '\0') {
         if (!isdigit(c)) {
             if (c == '.') {
 @@ -302,9 +303,12 @@ is_numeric(const char *str, bool *has_point)
                 return false;
             }
         }
 +       else if (!point) {
 +           numeric = true;
 +       }
      }
      *has_point = point;
 -    return true;
 +    return numeric;
  }

  static inline bool
 }}}

 Test Script:
 {{{
 require 'yaml'
 require 'test/unit/assertions.rb'
 include Test::Unit::Assertions

 assert_equal(["."], YAML.load('- .'))
 assert_equal([1.0], YAML.load('- 1.'))
 assert_equal([1.2], YAML.load('- 1.2'))
 assert_equal(["1.2.3"], YAML.load('- 1.2.3'))
 assert_equal([".5"], YAML.load('- .5'))

 puts :ok
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1017#comment:4>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list