Sha256: 85ee59e3079ec827ceaa854b31330597f23674b468caa0687639ee7a4591f0e5

Contents?: true

Size: 1.12 KB

Versions: 9

Compression:

Stored size: 1.12 KB

Contents

  #  _____         _
  # |_   _|__  ___| |_
  #   | |/ _ \/ __| __|
  #   | |  __/\__ \ |
  #   |_|\___||___/\__|
  #
  # for lib/facets/class_extension.rb
  #
  # Extracted Mon Sep 03 16:23:08 -0700 2007
  # w/ Test Extraction Ratchet
  #

 require 'facets/class_extension.rb'



  require 'test/unit'

  class TC_ClassMethods < Test::Unit::TestCase

    # fixture

    module N
      class_extension do
        def n ; 43 ; end
        def s ; self ; end
      end
      extend class_extension
    end

    class X
      include N
      def n ; 11 ; end
    end

    module K
      include N
      class_extension do
        def n ; super + 1 ; end
      end
    end

    class Z
      include K
    end

    # tests

    def test_01
      assert_equal( 43, N.n )
      assert_equal(  N,  N.s )
    end
    def test_02
      assert_equal( 43, X.n )
      assert_equal(  X, X.s )
    end
    def test_03
      assert_equal( 11, X.new.n )
    end
    def test_04
      assert_equal( 43, K.n )  #notic the difference!
      assert_equal(  K, K.s )
    end
    def test_05
      assert_equal( 44, Z.n )
      assert_equal(  Z, Z.s )
    end

  end



Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
facets-2.0.0 test/unit/test_class_extension.rb
facets-2.0.1 test/unit/test_class_extension.rb
facets-2.0.2 test/unit/test_class_extension.rb
facets-2.0.3 test/unit/test_class_extension.rb
facets-2.0.4 test/unit/test_class_extension.rb
facets-2.0.5 test/unit/test_class_extension.rb
facets-2.1.0 test/unit/test_class_extension.rb
facets-2.1.1 test/unit/test_class_extension.rb
facets-2.1.2 test/unit/test_class_extension.rb