1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2008-01-23 18:53:52 +00:00
parent 9580a9ca91
commit b97ec5d0c0
6 changed files with 12 additions and 6 deletions

View file

@ -1,3 +1,9 @@
Thu Jan 24 03:47:41 2008 NARUSE, Yui <naruse@ruby-lang.org>
* 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 <matz@ruby-lang.org>
* string.c (rb_str_each_line): use memchr(3) for faster newline

View file

@ -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]

View file

@ -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

View file

@ -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]

View file

@ -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

View file

@ -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