Sha256: 8b8c12fbea669c5344a908d47f8df394dcb78889cdeb3343c8c496378726e643

Contents?: true

Size: 803 Bytes

Versions: 4

Compression:

Stored size: 803 Bytes

Contents

$:.unshift 'lib'

require "test/unit"
require 'caruby/util/module'

module Outer
  module Middle
    module InnerModule; end
    class InnerClass; end
  end
end

class ModuleTest < Test::Unit::TestCase
  def test_top_level_module_with_name
    assert_equal(Array, Module.module_with_name(nil, 'Array'), "Top level module incorrect")
  end

  def test_module_with_unqualified_name
    assert_equal(Outer::Middle, Outer.module_with_name('Middle'), "Unqualified module incorrect")
  end

  def test_module_with_qualified_name
    assert_equal(Outer::Middle::InnerModule, Outer.module_with_name('Middle::InnerModule'), "Qualified module incorrect")
  end

  def test_class_with_name
    assert_equal(Outer::Middle::InnerClass, Outer.module_with_name('Middle::InnerClass'), "Inner class incorrect")
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
caruby-core-1.4.9 test/lib/caruby/util/module_test.rb
caruby-core-1.4.7 test/lib/caruby/util/module_test.rb
caruby-core-1.4.6 test/lib/caruby/util/module_test.rb
caruby-core-1.4.5 test/lib/caruby/util/module_test.rb