~ubuntu-branches/ubuntu/intrepid/ruby1.9/intrepid-updates

« back to all changes in this revision

Viewing changes to test/ruby/test_hash.rb

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-09-04 16:01:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070904160117-i15zckg2nhxe9fyw
Tags: 1.9.0+20070830-2ubuntu1
* Sync from Debian; remaining changes:
  - Add -g to CFLAGS.
* Fixes build failure on ia64.
* Fixes build failure with gcc-4.2 on lpia.
* Robustify check for target_os, fixing build failure on lpia.
* Set Ubuntu maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 
5
5
  def test_hash
6
6
    x = {1=>2, 2=>4, 3=>6}
7
 
    y = {1, 2, 2, 4, 3, 6}
 
7
    y = {1=>2, 2=>4, 3=>6} # y = {1, 2, 2, 4, 3, 6} # 1.9 doesn't support
8
8
 
9
9
    assert_equal(2, x[1])
10
10
 
266
266
    h = base.dup
267
267
    assert_equal(h3, h.delete_if {|k,v| v })
268
268
    assert_equal(h3, h)
 
269
 
 
270
    h = base.dup
 
271
    n = 0
 
272
    h.delete_if {|*a|
 
273
      n += 1
 
274
      assert_equal(2, a.size)
 
275
      assert_equal(base[a[0]], a[1])
 
276
      h.shift
 
277
      true
 
278
    }
 
279
    assert_equal(base.size, n)
269
280
  end
270
281
 
271
282
  def test_dup