Skip to content

Commit 1dc0209

Browse files
committed
test_regexp.rb, test_string.rb: suppress warnings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent d4ef0b4 commit 1dc0209

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

test/ruby/test_regexp.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def test_unescape
380380
assert_equal(/a/, eval(%q(s="\u0061";/#{s}/n)))
381381
assert_raise(RegexpError) { s = "\u3042"; eval(%q(/#{s}/n)) }
382382
assert_raise(RegexpError) { s = "\u0061"; eval(%q(/\u3042#{s}/n)) }
383-
assert_raise(RegexpError) { s1=[0xff].pack("C"); s2="\u3042"; eval(%q(/#{s1}#{s2}/)) }
383+
assert_raise(RegexpError) { s1=[0xff].pack("C"); s2="\u3042"; eval(%q(/#{s1}#{s2}/)); [s1, s2] }
384384

385385
assert_raise(ArgumentError) { s = '\x'; /#{ s }/ }
386386

@@ -593,7 +593,7 @@ def test_parse
593593
check(/\A\80\z/, "80", ["\100", ""])
594594
check(/\A\77\z/, "?")
595595
check(/\A\78\z/, "\7" + '8', ["\100", ""])
596-
check(/\A\Qfoo\E\z/, "QfooE")
596+
check(eval('/\A\Qfoo\E\z/'), "QfooE")
597597
check(/\Aa++\z/, "aaa")
598598
check('\Ax]\z', "x]")
599599
check(/x#foo/x, "x", "#foo")
@@ -767,9 +767,9 @@ def test_char_class
767767

768768
def test_posix_bracket
769769
check(/\A[[:alpha:]0]\z/, %w(0 a), %w(1 .))
770-
check(/\A[[:^alpha:]0]\z/, %w(0 1 .), "a")
771-
check(/\A[[:alpha\:]]\z/, %w(a l p h a :), %w(b 0 1 .))
772-
check(/\A[[:alpha:foo]0]\z/, %w(0 a), %w(1 .))
770+
check(eval('/\A[[:^alpha:]0]\z/'), %w(0 1 .), "a")
771+
check(eval('/\A[[:alpha\:]]\z/'), %w(a l p h a :), %w(b 0 1 .))
772+
check(eval('/\A[[:alpha:foo]0]\z/'), %w(0 a), %w(1 .))
773773
check(/\A[[:xdigit:]&&[:alpha:]]\z/, "a", %w(g 0))
774774
check('\A[[:abcdefghijklmnopqrstu:]]+\z', "[]")
775775
failcheck('[[:alpha')
@@ -1003,7 +1003,7 @@ def test_once
10031003
# escape
10041004
pr4 = proc{|i|
10051005
catch(:xyzzy){
1006-
/#{throw :xyzzy, i}/o
1006+
/#{throw :xyzzy, i}/o =~ ""
10071007
:ng
10081008
}
10091009
}

test/ruby/test_string.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2189,8 +2189,8 @@ def test_byteslice
21892189
assert_equal(u("\x82")+("\u3042"*9), ("\u3042"*10).byteslice(2, 28))
21902190

21912191
bug7954 = '[ruby-dev:47108]'
2192-
assert_equal(false, "\u3042".byteslice(0, 2).valid_encoding?)
2193-
assert_equal(false, ("\u3042"*10).byteslice(0, 20).valid_encoding?)
2192+
assert_equal(false, "\u3042".byteslice(0, 2).valid_encoding?, bug7954)
2193+
assert_equal(false, ("\u3042"*10).byteslice(0, 20).valid_encoding?, bug7954)
21942194
end
21952195

21962196
def test_unknown_string_option

0 commit comments

Comments
 (0)