diff options
-rw-r--r-- | ext/dl/lib/dl/cparser.rb | 2 | ||||
-rw-r--r-- | lib/cgi/cookie.rb | 2 | ||||
-rw-r--r-- | lib/rdoc/ruby_lex.rb | 2 | ||||
-rw-r--r-- | lib/xmlrpc/parser.rb | 2 | ||||
-rw-r--r-- | sample/mkproto.rb | 6 | ||||
-rw-r--r-- | test/bigdecimal/test_bigdecimal.rb | 5 | ||||
-rw-r--r-- | test/ruby/test_math.rb | 16 |
7 files changed, 17 insertions, 18 deletions
diff --git a/ext/dl/lib/dl/cparser.rb b/ext/dl/lib/dl/cparser.rb index 2e78da5ad6..be23ab4567 100644 --- a/ext/dl/lib/dl/cparser.rb +++ b/ext/dl/lib/dl/cparser.rb @@ -39,7 +39,7 @@ module DL tymap ||= {} signature = signature.gsub(/\s+/, " ").strip case signature - when /^([\d\w@\*_\s]+)\(([\d\w\*_\s\,\[\]]*)\)$/ + when /^([\w@\*\s]+)\(([\w\*\s\,\[\]]*)\)$/ ret = $1 (args = $2).strip! ret = ret.split(/\s+/) diff --git a/lib/cgi/cookie.rb b/lib/cgi/cookie.rb index 513bd40989..97a92efc3a 100644 --- a/lib/cgi/cookie.rb +++ b/lib/cgi/cookie.rb @@ -54,6 +54,8 @@ class CGI # # These keywords correspond to attributes of the cookie object. def initialize(name = "", *value) + @domain = nil + @expires = nil if name.kind_of?(String) @name = name %r|^(.*/)|.match(ENV["SCRIPT_NAME"]) diff --git a/lib/rdoc/ruby_lex.rb b/lib/rdoc/ruby_lex.rb index eda7b81e1f..59de6cc762 100644 --- a/lib/rdoc/ruby_lex.rb +++ b/lib/rdoc/ruby_lex.rb @@ -453,7 +453,7 @@ class RDoc::RubyLex if @lex_state != EXPR_END && @lex_state != EXPR_CLASS && (@lex_state != EXPR_ARG || @space_seen) c = peek(0) - if /\S/ =~ c && (/["'`]/ =~ c || /[\w_]/ =~ c || c == "-") + if /\S/ =~ c && (/["'`]/ =~ c || /\w/ =~ c || c == "-") tk = identify_here_document end end diff --git a/lib/xmlrpc/parser.rb b/lib/xmlrpc/parser.rb index d078de2f4b..d8e91b0098 100644 --- a/lib/xmlrpc/parser.rb +++ b/lib/xmlrpc/parser.rb @@ -133,7 +133,7 @@ module XMLRPC hash.delete "___class___" hash.each {|key, value| - obj.instance_variable_set("@#{ key }", value) if key =~ /^([\w_][\w_0-9]*)$/ + obj.instance_variable_set("@#{ key }", value) if key =~ /^([a-zA-Z_]\w*)$/ } obj rescue diff --git a/sample/mkproto.rb b/sample/mkproto.rb index 754ca2dff2..6e7fc0f788 100644 --- a/sample/mkproto.rb +++ b/sample/mkproto.rb @@ -1,20 +1,20 @@ $/ = nil while line = gets() - if /^((void|VALUE|int|char *\*|ID|struct [\w_]+ *\*|st_table *\*) *)?\n([\w\d_]+)\(.*\)\n\s*((.+;\n)*)\{/ =~ line + if /^((void|VALUE|int|char *\*|ID|struct \w+ *\*|st_table *\*) *)?\n(\w+)\(.*\)\n\s*((.+;\n)*)\{/ =~ line line = $' printf "%s %s(", $2, $3 args = [] for arg in $4.split(/;\n\s*/) arg.gsub!(/ +/, ' ') if arg =~ /,/ - if arg =~ /(([^*]+) *\** *[\w\d_]+),/ + if arg =~ /(([^*]+) *\** *\w+),/ type = $2.strip args.push $1.strip arg = $' else type = "" end - while arg.sub!(/(\** *[\w\d_]+)(,|$)/, "") && $~ + while arg.sub!(/(\** *\w+)(,|$)/, "") && $~ args.push type + " " + $1.strip end else diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index a9dae35274..9d21588a95 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -355,6 +355,7 @@ class TestBigDecimal < Test::Unit::TestCase a, b = BigDecimal.new("1").coerce(1.0) assert_instance_of(Float, a) assert_instance_of(Float, b) + assert_equal(2, 1 + BigDecimal.new("1"), '[ruby-core:25697]') end def test_uplus @@ -703,8 +704,4 @@ class TestBigDecimal < Test::Unit::TestCase assert_equal(BigDecimal::SIGN_POSITIVE_ZERO, BigDecimal.new("1E-1" + "0" * 10000).sign) assert_equal(BigDecimal::SIGN_NEGATIVE_ZERO, BigDecimal.new("-1E-1" + "0" * 10000).sign) end - - def test_coerce - assert_equal(2, 1 + BigDecimal.new("1"), '[ruby-core:25697]') - end end diff --git a/test/ruby/test_math.rb b/test/ruby/test_math.rb index 15a9b83c35..64b72ce5c0 100644 --- a/test/ruby/test_math.rb +++ b/test/ruby/test_math.rb @@ -114,8 +114,8 @@ class TestMath < Test::Unit::TestCase check(0, Math.atanh(Math.sinh(0) / Math.cosh(0))) check(1, Math.atanh(Math.sinh(1) / Math.cosh(1))) check(2, Math.atanh(Math.sinh(2) / Math.cosh(2))) - assert_nothing_raised { assert_infinity Math.atanh(1) } - assert_nothing_raised { assert_infinity -Math.atanh(-1) } + assert_nothing_raised { assert_infinity(Math.atanh(1)) } + assert_nothing_raised { assert_infinity(-Math.atanh(-1)) } assert_raise(Math::DomainError) { Math.atanh(+1.0 + Float::EPSILON) } assert_raise(Math::DomainError) { Math.atanh(-1.0 - Float::EPSILON) } end @@ -134,8 +134,8 @@ class TestMath < Test::Unit::TestCase check(1, Math.log(10, 10)) check(2, Math.log(100, 10)) assert_equal(1.0/0, Math.log(1.0/0)) - assert_nothing_raised { assert_infinity -Math.log(+0.0) } - assert_nothing_raised { assert_infinity -Math.log(-0.0) } + assert_nothing_raised { assert_infinity(-Math.log(+0.0)) } + assert_nothing_raised { assert_infinity(-Math.log(-0.0)) } assert_raise(Math::DomainError) { Math.log(-1.0) } assert_raise(TypeError) { Math.log(1,nil) } end @@ -145,8 +145,8 @@ class TestMath < Test::Unit::TestCase check(1, Math.log2(2)) check(2, Math.log2(4)) assert_equal(1.0/0, Math.log2(1.0/0)) - assert_nothing_raised { assert_infinity -Math.log2(+0.0) } - assert_nothing_raised { assert_infinity -Math.log2(-0.0) } + assert_nothing_raised { assert_infinity(-Math.log2(+0.0)) } + assert_nothing_raised { assert_infinity(-Math.log2(-0.0)) } assert_raise(Math::DomainError) { Math.log2(-1.0) } end @@ -155,8 +155,8 @@ class TestMath < Test::Unit::TestCase check(1, Math.log10(10)) check(2, Math.log10(100)) assert_equal(1.0/0, Math.log10(1.0/0)) - assert_nothing_raised { assert_infinity -Math.log10(+0.0) } - assert_nothing_raised { assert_infinity -Math.log10(-0.0) } + assert_nothing_raised { assert_infinity(-Math.log10(+0.0)) } + assert_nothing_raised { assert_infinity(-Math.log10(-0.0)) } assert_raise(Math::DomainError) { Math.log10(-1.0) } end |