mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/rdoc] Fix the known classes more
https://github.com/ruby/rdoc/commit/9f47234e0e
This commit is contained in:
parent
c7dd5b65d4
commit
b564ef3698
2 changed files with 26 additions and 5 deletions
|
@ -46,8 +46,8 @@ module RDoc
|
|||
"rb_eInterrupt" => "Interrupt",
|
||||
"rb_eLoadError" => "LoadError",
|
||||
"rb_eNameError" => "NameError",
|
||||
"rb_eNoMemError" => "NoMemError",
|
||||
"rb_eNotImpError" => "NotImpError",
|
||||
"rb_eNoMemError" => "NoMemoryError",
|
||||
"rb_eNotImpError" => "NotImplementedError",
|
||||
"rb_eRangeError" => "RangeError",
|
||||
"rb_eRuntimeError" => "RuntimeError",
|
||||
"rb_eScriptError" => "ScriptError",
|
||||
|
@ -58,7 +58,7 @@ module RDoc
|
|||
"rb_eSystemCallError" => "SystemCallError",
|
||||
"rb_eSystemExit" => "SystemExit",
|
||||
"rb_eTypeError" => "TypeError",
|
||||
"rb_eZeroDivError" => "ZeroDivError",
|
||||
"rb_eZeroDivError" => "ZeroDivisionError",
|
||||
|
||||
"rb_mComparable" => "Comparable",
|
||||
"rb_mEnumerable" => "Enumerable",
|
||||
|
|
|
@ -101,6 +101,29 @@ class TestRDocParserC < RDoc::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_known_classes
|
||||
RDoc::KNOWN_CLASSES.each do |var, name|
|
||||
case name
|
||||
when "Refinement"
|
||||
next unless defined?(Refinement)
|
||||
when "Bignum", "Fixnum", "Data", "Socket", /\A(?![A-Z])/
|
||||
next
|
||||
end
|
||||
obj = Object.const_get(name)
|
||||
assert_equal obj.name, name
|
||||
case var
|
||||
when /\Arb_c/
|
||||
assert_kind_of Class, obj
|
||||
when /\Arb_m/
|
||||
assert_kind_of Module, obj
|
||||
when /\Arb_e/
|
||||
assert_operator obj, :<=, Exception
|
||||
else
|
||||
raise "unknown prefix: #{var} => #{name}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_initialize
|
||||
some_ext = @top_level.add_class RDoc::NormalClass, 'SomeExt'
|
||||
@top_level.add_class RDoc::SingleClass, 'SomeExtSingle'
|
||||
|
@ -115,8 +138,6 @@ class TestRDocParserC < RDoc::TestCase
|
|||
|
||||
parser = RDoc::Parser::C.new @top_level, @fn, '', @options, @stats
|
||||
|
||||
assert_equal "ArgumentError", parser.known_classes["rb_eArgError"]
|
||||
|
||||
expected = { 'cSomeExt' => some_ext }
|
||||
assert_equal expected, parser.classes
|
||||
|
||||
|
|
Loading…
Reference in a new issue