diff --git a/ChangeLog b/ChangeLog index 2ca97f5c41..e0ca823e1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jan 24 03:47:41 2008 NARUSE, Yui + + * lib/rexml/text.rb, lib/rubygems/open-uri.rb, lib/open-uri.rb, + test/logger/test_logger.rb, test/ruby/test_regexp.rb: + fix tests. [ruby-dev:33336] + Thu Jan 24 03:23:44 2008 Yukihiro Matsumoto * string.c (rb_str_each_line): use memchr(3) for faster newline diff --git a/lib/open-uri.rb b/lib/open-uri.rb index a981f58eda..2b6cd8fd65 100644 --- a/lib/open-uri.rb +++ b/lib/open-uri.rb @@ -433,7 +433,7 @@ module OpenURI subtype = $2.downcase parameters = [] $3.scan(/;#{RE_LWS}?(#{RE_TOKEN})#{RE_LWS}?=#{RE_LWS}?(?:(#{RE_TOKEN})|(#{RE_QUOTED_STRING}))/no) {|att, val, qval| - val = qval.gsub(/[\r\n\t !#-\[\]-~\x80-\xff]+|(\\[\x00-\x7f])/) { $1 ? $1[1,1] : $& } if qval + val = qval.gsub(/[\r\n\t !#-\[\]-~\x80-\xff]+|(\\[\x00-\x7f])/n) { $1 ? $1[1,1] : $& } if qval parameters << [att.downcase, val] } ["#{type}/#{subtype}", *parameters] diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb index c23cd17c02..73a72ae527 100644 --- a/lib/rexml/text.rb +++ b/lib/rexml/text.rb @@ -50,7 +50,7 @@ module REXML | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 - )*$/x; + )*$/nx; end # Constructor @@ -139,7 +139,7 @@ module REXML end end else - string.scan(/[\x00-\x7F]|[\x80-\xBF][\xC0-\xF0]*|[\xC0-\xF0]/) do |c| + string.scan(/[\x00-\x7F]|[\x80-\xBF][\xC0-\xF0]*|[\xC0-\xF0]/n) do |c| case c.unpack('U') when *VALID_CHAR else diff --git a/lib/rubygems/open-uri.rb b/lib/rubygems/open-uri.rb index ffc8e48571..50fa94374c 100644 --- a/lib/rubygems/open-uri.rb +++ b/lib/rubygems/open-uri.rb @@ -426,7 +426,7 @@ module OpenURI subtype = $2.downcase parameters = [] $3.scan(/;#{RE_LWS}?(#{RE_TOKEN})#{RE_LWS}?=#{RE_LWS}?(?:(#{RE_TOKEN})|(#{RE_QUOTED_STRING}))/no) {|att, val, qval| - val = qval.gsub(/[\r\n\t !#-\[\]-~\x80-\xff]+|(\\[\x00-\x7f])/) { $1 ? $1[1,1] : $& } if qval + val = qval.gsub(/[\r\n\t !#-\[\]-~\x80-\xff]+|(\\[\x00-\x7f])/n) { $1 ? $1[1,1] : $& } if qval parameters << [att.downcase, val] } ["#{type}/#{subtype}", *parameters] diff --git a/test/logger/test_logger.rb b/test/logger/test_logger.rb index e69638b5ee..12728c608b 100644 --- a/test/logger/test_logger.rb +++ b/test/logger/test_logger.rb @@ -26,7 +26,7 @@ class TestLogger < Test::Unit::TestCase class Log attr_reader :label, :datetime, :pid, :severity, :progname, :msg def initialize(line) - /\A(\w+), \[([^#]*)#(\d+)\]\s+(\w+) -- (\w*): ([\x0-\xff]*)/ =~ line + /\A(\w+), \[([^#]*)#(\d+)\]\s+(\w+) -- (\w*): ([\x0-\xff]*)/n =~ line @label, @datetime, @pid, @severity, @progname, @msg = $1, $2, $3, $4, $5, $6 end end diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 520af49640..50aaefa618 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -8,7 +8,7 @@ class TestRegexp < Test::Unit::TestCase end def test_ruby_talk_116455 - assert_match(/^(\w{2,}).* ([A-Za-z\xa2\xc0-\xff]{2,}?)$/, "Hallo Welt") + assert_match(/^(\w{2,}).* ([A-Za-z\xa2\xc0-\xff]{2,}?)$/n, "Hallo Welt") end def test_ruby_dev_24887