Sha256: 59dc2ef6ea8c039652697b773d811cd4fb38c8452c3047f8490c3c156bfb2320

Contents?: true

Size: 1.23 KB

Versions: 10

Compression:

Stored size: 1.23 KB

Contents

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

 require 'facets/kernel/super.rb'



  require 'test/unit'

  class TestKernelSuper < Test::Unit::TestCase

    class X ; def x ; 1 ; end ; end
    class Y < X ; def x ; 2 ; end ; end
    class Z < Y ; def x ; superior(X) ; end ; end

    def test_superior
      z = Z.new
      assert_equal( 1, z.x )
    end

    class X2 ; def x ; 1 ; end ; end
    class Y2 < X2 ; def x ; 2 ; end ; end
    class Z2 < Y2 ; def x ; 3 ; end ; end

    def test_super_method
      x = X2.new
      z = Z2.new
      s0 = x.method( :x )
      s1 = z.super_method( X2, :x )
      assert_equal( s0.call, s1.call )
    end

    class A
      def x; "A.x"; end
      def y; "A.y"; end
    end
    class B < A
      def x; "B.x" end
      def y; "B.y" end
    end
    class C < B
      def x; "C.x"; end
      def y; as(B).x ; end
    end

    def test_as
      c = C.new
      assert_equal("B.x", c.y)
      assert_equal("C.x", c.x)
    end

    def test_send_as
      assert_equal( String, "A".send_as(Object, :class) )
    end

  end



Version data entries

10 entries across 10 versions & 1 rubygems

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