Sha256: ea410d9a91e1d2d9de737456800825da592081a92bb59feb70e9dd8d7c23df45

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

###### #####   #### ######
  ##   ##     ##      ##
  ##   ####     ##    ##
  ##   ##        ##   ##
  ##   #####  ####    ##

require 'test/unit'
require 'mega/notcopyable'

# fixture

class Foo
  include NotCopyable
end

class Bar < Foo
end

class Foo2
end

# test

class TC_NotCopyable < Test::Unit::TestCase

  def test_dup
    f = Foo.new
    assert_raises(TypeError) do
      g = f.dup
    end
  end

  def test_dup_derived
    f = Bar.new
    assert_raises(TypeError) do
      g = f.dup
    end
  end

  def test_dup_okay
    f = Foo2.new
    g = f.dup
  end

  def test_clone
    f = Foo.new
    assert_raises(TypeError) do
      g = f.clone
    end
  end

  def test_clone_derived
    f = Bar.new
    assert_raises(TypeError) do
      g = f.clone
    end
  end

  def test_clone_okay
    f = Foo2.new
    g = f.clone
  end

end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mega-0.3.1 test/tc_notcopyable.rb