Sha256: a87cf1f269fa6390b950c077ed5a13e70ceca9cf8d443a206bab6c6f9844b785

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
# for lib/facets/core/class/cattr.rb
#
# Extracted Wed Aug 23 18:22:52 EDT 2006
# Unit Tools Reap Test Extractor
#

require 'facets/core/class/cattr.rb'


  require 'test/unit'

  class TCModule < Test::Unit::TestCase

    class MockObject
      def initialize
        @@a = 10
      end
      def b ; @@b ; end
    end

    def test_cattr
      assert_nothing_raised {
        MockObject.class_eval { cattr :a }
      }
      t = MockObject.new
      assert_equal( 10, t.a )
    end

    def test_cattr_reader
      assert_nothing_raised {
        MockObject.class_eval { cattr_reader :a }
      }
      t = MockObject.new
      assert_equal( 10, t.a )
    end

    def test_cattr_writer
      assert_nothing_raised {
        MockObject.class_eval { cattr_writer :b }
      }
      t = MockObject.new
      t.b = 5
      assert_equal( 5, t.b )
    end

    def test_cattr_accessor
      assert_nothing_raised {
        MockObject.class_eval { cattr_accessor :c }
      }
      t = MockObject.new
      t.c = 50
      assert_equal( 50, t.c )
    end

  end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-1.7.30 test/lib/facets/core/class/test_cattr.rb