ruby-changes:72498
From: Nobuyoshi <ko1@a...>
Date: Mon, 11 Jul 2022 13:43:31 +0900 (JST)
Subject: [ruby-changes:72498] b564ef3698 (master): [ruby/rdoc] Fix the known classes more
https://git.ruby-lang.org/ruby.git/commit/?id=b564ef3698 From b564ef3698a76cabeb41b3085fab1258ac07c8cb Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 11 Jul 2022 13:34:15 +0900 Subject: [ruby/rdoc] Fix the known classes more https://github.com/ruby/rdoc/commit/9f47234e0e --- lib/rdoc/known_classes.rb | 6 +++--- test/rdoc/test_rdoc_parser_c.rb | 25 +++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/lib/rdoc/known_classes.rb b/lib/rdoc/known_classes.rb index bdda96ae0e..3e8752bbde 100644 --- a/lib/rdoc/known_classes.rb +++ b/lib/rdoc/known_classes.rb @@ -46,8 +46,8 @@ module RDoc https://github.com/ruby/ruby/blob/trunk/lib/rdoc/known_classes.rb#L46 "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 https://github.com/ruby/ruby/blob/trunk/lib/rdoc/known_classes.rb#L58 "rb_eSystemCallError" => "SystemCallError", "rb_eSystemExit" => "SystemExit", "rb_eTypeError" => "TypeError", - "rb_eZeroDivError" => "ZeroDivError", + "rb_eZeroDivError" => "ZeroDivisionError", "rb_mComparable" => "Comparable", "rb_mEnumerable" => "Enumerable", diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb index 8125f5def6..4bb18ce925 100644 --- a/test/rdoc/test_rdoc_parser_c.rb +++ b/test/rdoc/test_rdoc_parser_c.rb @@ -101,6 +101,29 @@ class TestRDocParserC < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_parser_c.rb#L101 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 https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_parser_c.rb#L138 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/