Sha256: a36bfeca9c670d9ceeb8231232d7a27a8f1b1e392fac830b24972f20f6580a51

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

require 'facets/module/nesting.rb'
require 'test/unit'

class TestModuleNesting < Test::Unit::TestCase

  def test_basename
    assert_equal( "TestCase", ::Test::Unit::TestCase.basename )
  end

  def test_spacename
    assert_equal( 'Test::Unit', Test::Unit::TestCase.spacename )
    assert_equal( 'Test::Unit', ::Test::Unit::TestCase.spacename )
    assert_equal( '', Test.spacename )
    assert_equal( '', ::Test.spacename )
  end

  def test_modspace
    assert_equal( Test::Unit, Test::Unit::TestCase.modspace )
    assert_equal( ::Test::Unit, ::Test::Unit::TestCase.modspace )
    assert_equal( Object, ::Test.modspace )
  end

  module M
    module N
      class C
        def n
          self.class.nesting
        end
      end
    end
  end

  def test_nesting
    assert_equal( [TestModuleNesting, M, M::N, M::N::C], M::N::C.new.n )
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-2.4.0 test/module/test_nesting.rb