Sha256: 9834693c2837e31da77ecb6b15faad781164e1422c127d92a10eb7d3ed5dde15

Contents?: true

Size: 399 Bytes

Versions: 2

Compression:

Stored size: 399 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

class Foo
  def add(n)
    42 + n
  end
end


class ObjectTest < Test::Unit::TestCase
  def test_try
    assert_nil(nil.try { |me| me.foo })
    assert(true.try { |me| me })
    assert_not_nil(true.try(:nil?))
    assert_equal(Foo.new.try(:add,10),52)
  end

  def test_tap
    f = Foo.new
    assert_equal(f.tap { |me| assert_equal(me,f) }, f)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
darkhelmet-darkext-0.11.1 test/object_test.rb
darkhelmet-darkext-0.11.2 test/object_test.rb