Project

General

Profile

Misc #11757 » 0001-Remove-not-executed-tests.patch

yui-knk (Kaneko Yuichiro), 12/01/2015 12:58 PM

View differences:

test/ruby/test_string.rb
1 1
require 'test/unit'
2 2

  
3
# use of $= is deprecated after 1.7.1
4
def pre_1_7_1
5
end
6

  
7 3
class TestString < Test::Unit::TestCase
8 4
  ENUMERATOR_WANTARRAY = RUBY_VERSION >= "3.0.0"
9 5

  
......
126 122
    s[S("Foo")] = S("Bar")
127 123
    assert_equal(S("BarBar"), s)
128 124

  
129
    pre_1_7_1 do
130
      s = S("FooBar")
131
      s[S("Foo")] = S("xyz")
132
      assert_equal(S("xyzBar"), s)
133

  
134
      $= = true
135
      s = S("FooBar")
136
      s[S("FOO")] = S("Bar")
137
      assert_equal(S("BarBar"), s)
138
      s[S("FOO")] = S("xyz")
139
      assert_equal(S("BarBar"), s)
140
      $= = false
141
    end
142

  
143 125
    s = S("a string")
144 126
    s[0..s.size] = S("another string")
145 127
    assert_equal(S("another string"), s)
......
160 142

  
161 143
    assert_equal(-1, S("ABCDEF") <=> S("abcdef"))
162 144

  
163
    pre_1_7_1 do
164
      $= = true
165
      assert_equal(0, S("ABCDEF") <=> S("abcdef"))
166
      $= = false
167
    end
168

  
169 145
    assert_nil("foo" <=> Object.new)
170 146

  
171 147
    o = Object.new
......
189 165
    assert_not_equal(:foo, S("foo"))
190 166
    assert_equal(S("abcdef"), S("abcdef"))
191 167

  
192
    pre_1_7_1 do
193
      $= = true
194
      assert_equal(S("CAT"), S('cat'))
195
      assert_equal(S("CaT"), S('cAt'))
196
      $= = false
197
    end
198

  
199 168
    assert_not_equal(S("CAT"), S('cat'))
200 169
    assert_not_equal(S("CaT"), S('cAt'))
201 170

  
......
235 204
    assert_equal(10,  S("FeeFieFoo-Fum") =~ /Fum$/)
236 205
    assert_equal(nil, S("FeeFieFoo-Fum") =~ /FUM$/)
237 206

  
238
    pre_1_7_1 do
239
      $= = true
240
      assert_equal(10,  S("FeeFieFoo-Fum") =~ /FUM$/)
241
      $= = false
242
    end
243

  
244 207
    o = Object.new
245 208
    def o.=~(x); x + "bar"; end
246 209
    assert_equal("foobar", S("foo") =~ o)
......
292 255
    # assert_equal(true, S("foo") === :foo)
293 256
    casetest(S("abcdef"), S("abcdef"))
294 257

  
295
    pre_1_7_1 do
296
      $= = true
297
      casetest(S("CAT"), S('cat'))
298
      casetest(S("CaT"), S('cAt'))
299
      $= = false
300
    end
301

  
302 258
    casetest(S("CAT"), S('cat'), true) # Reverse the test - we don't want to
303 259
    casetest(S("CaT"), S('cAt'), true) # find these in the case.
304 260
  end
......
1309 1265
    assert_equal(S("Bar"), a.slice!(S("Bar")))
1310 1266
    assert_equal(S("Foo"), a)
1311 1267

  
1312
    pre_1_7_1 do
1313
      a=S("FooBar")
1314
      assert_nil(a.slice!(S("xyzzy")))
1315
      assert_equal(S("FooBar"), a)
1316
      assert_nil(a.slice!(S("plugh")))
1317
      assert_equal(S("FooBar"), a)
1318
    end
1319

  
1320 1268
    assert_raise(ArgumentError) { "foo".slice! }
1321 1269
  end
1322 1270

  
1323
-