aboutsummaryrefslogblamecommitdiffstats
path: root/activesupport/test/core_ext/duplicable_test.rb
blob: 5e34184a468fa7ffe1e4f39780121bc576441d7b (plain) (tree)
1
2
3
4
5



                                                                   
                                                  
















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

class DuplicableTest < Test::Unit::TestCase
  NO  = [nil, false, true, :symbol, 1, 2.3, BigDecimal.new('4.56')]
  YES = ['1', Object.new, /foo/, [], {}, Time.now]

  def test_duplicable
    NO.each do |v|
      assert !v.duplicable?
      begin
        v.dup
        fail
      rescue Exception
      end
    end

    YES.each do |v|
      assert v.duplicable?
      assert_nothing_raised { v.dup }
    end
  end
end