[Bug #20277] Remove stale String
test conditionals
These instance variables for conditional execution have remained unchanged for nearly twenty years, since YARV merger.
This commit is contained in:
parent
9a19cfd4cd
commit
76bd586330
@ -9,9 +9,6 @@ class TestString < Test::Unit::TestCase
|
|||||||
|
|
||||||
def initialize(*args)
|
def initialize(*args)
|
||||||
@cls = String
|
@cls = String
|
||||||
@aref_re_nth = true
|
|
||||||
@aref_re_silent = false
|
|
||||||
@aref_slicebang_silent = true
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -153,14 +150,12 @@ CODE
|
|||||||
assert_equal(nil, S("FooBar")[S("xyzzy")])
|
assert_equal(nil, S("FooBar")[S("xyzzy")])
|
||||||
assert_equal(nil, S("FooBar")[S("plugh")])
|
assert_equal(nil, S("FooBar")[S("plugh")])
|
||||||
|
|
||||||
if @aref_re_nth
|
assert_equal(S("Foo"), S("FooBar")[/([A-Z]..)([A-Z]..)/, 1])
|
||||||
assert_equal(S("Foo"), S("FooBar")[/([A-Z]..)([A-Z]..)/, 1])
|
assert_equal(S("Bar"), S("FooBar")[/([A-Z]..)([A-Z]..)/, 2])
|
||||||
assert_equal(S("Bar"), S("FooBar")[/([A-Z]..)([A-Z]..)/, 2])
|
assert_equal(nil, S("FooBar")[/([A-Z]..)([A-Z]..)/, 3])
|
||||||
assert_equal(nil, S("FooBar")[/([A-Z]..)([A-Z]..)/, 3])
|
assert_equal(S("Bar"), S("FooBar")[/([A-Z]..)([A-Z]..)/, -1])
|
||||||
assert_equal(S("Bar"), S("FooBar")[/([A-Z]..)([A-Z]..)/, -1])
|
assert_equal(S("Foo"), S("FooBar")[/([A-Z]..)([A-Z]..)/, -2])
|
||||||
assert_equal(S("Foo"), S("FooBar")[/([A-Z]..)([A-Z]..)/, -2])
|
assert_equal(nil, S("FooBar")[/([A-Z]..)([A-Z]..)/, -3])
|
||||||
assert_equal(nil, S("FooBar")[/([A-Z]..)([A-Z]..)/, -3])
|
|
||||||
end
|
|
||||||
|
|
||||||
o = Object.new
|
o = Object.new
|
||||||
def o.to_int; 2; end
|
def o.to_int; 2; end
|
||||||
@ -206,24 +201,18 @@ CODE
|
|||||||
assert_equal(S("BarBar"), s)
|
assert_equal(S("BarBar"), s)
|
||||||
s[/..r$/] = S("Foo")
|
s[/..r$/] = S("Foo")
|
||||||
assert_equal(S("BarFoo"), s)
|
assert_equal(S("BarFoo"), s)
|
||||||
if @aref_re_silent
|
assert_raise(IndexError) { s[/xyzzy/] = S("None") }
|
||||||
s[/xyzzy/] = S("None")
|
|
||||||
assert_equal(S("BarFoo"), s)
|
s[/([A-Z]..)([A-Z]..)/, 1] = S("Foo")
|
||||||
else
|
assert_equal(S("FooFoo"), s)
|
||||||
assert_raise(IndexError) { s[/xyzzy/] = S("None") }
|
s[/([A-Z]..)([A-Z]..)/, 2] = S("Bar")
|
||||||
end
|
assert_equal(S("FooBar"), s)
|
||||||
if @aref_re_nth
|
assert_raise(IndexError) { s[/([A-Z]..)([A-Z]..)/, 3] = "None" }
|
||||||
s[/([A-Z]..)([A-Z]..)/, 1] = S("Foo")
|
s[/([A-Z]..)([A-Z]..)/, -1] = S("Foo")
|
||||||
assert_equal(S("FooFoo"), s)
|
assert_equal(S("FooFoo"), s)
|
||||||
s[/([A-Z]..)([A-Z]..)/, 2] = S("Bar")
|
s[/([A-Z]..)([A-Z]..)/, -2] = S("Bar")
|
||||||
assert_equal(S("FooBar"), s)
|
assert_equal(S("BarFoo"), s)
|
||||||
assert_raise(IndexError) { s[/([A-Z]..)([A-Z]..)/, 3] = "None" }
|
assert_raise(IndexError) { s[/([A-Z]..)([A-Z]..)/, -3] = "None" }
|
||||||
s[/([A-Z]..)([A-Z]..)/, -1] = S("Foo")
|
|
||||||
assert_equal(S("FooFoo"), s)
|
|
||||||
s[/([A-Z]..)([A-Z]..)/, -2] = S("Bar")
|
|
||||||
assert_equal(S("BarFoo"), s)
|
|
||||||
assert_raise(IndexError) { s[/([A-Z]..)([A-Z]..)/, -3] = "None" }
|
|
||||||
end
|
|
||||||
|
|
||||||
s = S("FooBar")
|
s = S("FooBar")
|
||||||
s[S("Foo")] = S("Bar")
|
s[S("Foo")] = S("Bar")
|
||||||
@ -1744,20 +1733,11 @@ CODE
|
|||||||
assert_equal(S("FooBa"), a)
|
assert_equal(S("FooBa"), a)
|
||||||
|
|
||||||
a = S("FooBar")
|
a = S("FooBar")
|
||||||
if @aref_slicebang_silent
|
assert_nil( a.slice!(6) )
|
||||||
assert_nil( a.slice!(6) )
|
assert_nil( a.slice!(6r) )
|
||||||
assert_nil( a.slice!(6r) )
|
|
||||||
else
|
|
||||||
assert_raise(IndexError) { a.slice!(6) }
|
|
||||||
assert_raise(IndexError) { a.slice!(6r) }
|
|
||||||
end
|
|
||||||
assert_equal(S("FooBar"), a)
|
assert_equal(S("FooBar"), a)
|
||||||
|
|
||||||
if @aref_slicebang_silent
|
assert_nil( a.slice!(-7) )
|
||||||
assert_nil( a.slice!(-7) )
|
|
||||||
else
|
|
||||||
assert_raise(IndexError) { a.slice!(-7) }
|
|
||||||
end
|
|
||||||
assert_equal(S("FooBar"), a)
|
assert_equal(S("FooBar"), a)
|
||||||
|
|
||||||
a = S("FooBar")
|
a = S("FooBar")
|
||||||
@ -1769,17 +1749,9 @@ CODE
|
|||||||
assert_equal(S("Foo"), a)
|
assert_equal(S("Foo"), a)
|
||||||
|
|
||||||
a=S("FooBar")
|
a=S("FooBar")
|
||||||
if @aref_slicebang_silent
|
|
||||||
assert_nil(a.slice!(7,2)) # Maybe should be six?
|
assert_nil(a.slice!(7,2)) # Maybe should be six?
|
||||||
else
|
|
||||||
assert_raise(IndexError) {a.slice!(7,2)} # Maybe should be six?
|
|
||||||
end
|
|
||||||
assert_equal(S("FooBar"), a)
|
assert_equal(S("FooBar"), a)
|
||||||
if @aref_slicebang_silent
|
|
||||||
assert_nil(a.slice!(-7,10))
|
assert_nil(a.slice!(-7,10))
|
||||||
else
|
|
||||||
assert_raise(IndexError) {a.slice!(-7,10)}
|
|
||||||
end
|
|
||||||
assert_equal(S("FooBar"), a)
|
assert_equal(S("FooBar"), a)
|
||||||
|
|
||||||
a=S("FooBar")
|
a=S("FooBar")
|
||||||
@ -1791,17 +1763,9 @@ CODE
|
|||||||
assert_equal(S("Foo"), a)
|
assert_equal(S("Foo"), a)
|
||||||
|
|
||||||
a=S("FooBar")
|
a=S("FooBar")
|
||||||
if @aref_slicebang_silent
|
|
||||||
assert_equal(S(""), a.slice!(6..2))
|
assert_equal(S(""), a.slice!(6..2))
|
||||||
else
|
|
||||||
assert_raise(RangeError) {a.slice!(6..2)}
|
|
||||||
end
|
|
||||||
assert_equal(S("FooBar"), a)
|
assert_equal(S("FooBar"), a)
|
||||||
if @aref_slicebang_silent
|
|
||||||
assert_nil(a.slice!(-10..-7))
|
assert_nil(a.slice!(-10..-7))
|
||||||
else
|
|
||||||
assert_raise(RangeError) {a.slice!(-10..-7)}
|
|
||||||
end
|
|
||||||
assert_equal(S("FooBar"), a)
|
assert_equal(S("FooBar"), a)
|
||||||
|
|
||||||
a=S("FooBar")
|
a=S("FooBar")
|
||||||
@ -1813,17 +1777,9 @@ CODE
|
|||||||
assert_equal(S("Foo"), a)
|
assert_equal(S("Foo"), a)
|
||||||
|
|
||||||
a=S("FooBar")
|
a=S("FooBar")
|
||||||
if @aref_slicebang_silent
|
assert_nil(a.slice!(/xyzzy/))
|
||||||
assert_nil(a.slice!(/xyzzy/))
|
|
||||||
else
|
|
||||||
assert_raise(IndexError) {a.slice!(/xyzzy/)}
|
|
||||||
end
|
|
||||||
assert_equal(S("FooBar"), a)
|
assert_equal(S("FooBar"), a)
|
||||||
if @aref_slicebang_silent
|
assert_nil(a.slice!(/plugh/))
|
||||||
assert_nil(a.slice!(/plugh/))
|
|
||||||
else
|
|
||||||
assert_raise(IndexError) {a.slice!(/plugh/)}
|
|
||||||
end
|
|
||||||
assert_equal(S("FooBar"), a)
|
assert_equal(S("FooBar"), a)
|
||||||
|
|
||||||
a=S("FooBar")
|
a=S("FooBar")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user