Sha256: 9cbff7963cc6e78e558a30e9be123fe8fbb16ca3303c6420cbf91133fb7c01e0

Contents?: true

Size: 646 Bytes

Versions: 1

Compression:

Stored size: 646 Bytes

Contents

# Test facets/namespace.rb

require 'facets/namespace.rb'
require 'test/unit'

class TestNamespace1 < Test::Unit::TestCase

  module M
    def x; "x"; end
  end

  class C
    method_space M
  end

  def test_01
    c = C.new
    assert_equal('x', c.m.x)
  end

  def test_02
    c = C.new
    assert_raises(NoMethodError){ c.x }
  end

end

class TestNamespace2 < Test::Unit::TestCase

  class B
    def x; 1; end
  end

  class C < B
    def x; super; end
    method_space :m do
      def x; "x"; end
    end
  end

  def test_01
    c = C.new
    assert_equal('x', c.m.x)
  end

  def test_02
    c = C.new
    assert_equal(1, c.x)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-2.1.3 test/unit/test_namespace.rb