Closed mtasaka closed 3 years ago
Test suite of coderay executes test/unit/suite.rb, whic fails with ruby 3.0:
[mockbuild@8eabb111bdc5457cb9de184d095055ec coderay]$ ruby -v ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux] [mockbuild@8eabb111bdc5457cb9de184d095055ec coderay]$ ruby ./test/unit/suite.rb Running CodeRay unit tests: comment_filter, count, debug, duo, file_type, filter, html, json_encoder, lines_of_code, null, plugin, statistic, text, token_kind_filter, tokens, word_list Loaded suite ./test/unit/suite Started ....E =========================================================================================================================================================================== Error: test_filtering_text_tokens(DebugEncoderTest): NoMethodError: undefined method `debug' for ["10", :integer, "(\\)", :operator, :begin_group, :string, "test", :content, :end_group, :string, :begin_line, :head, "\n", :space, "\n \t", :space, " \n", :space, "[]", :method, :end_line, :head]:Array /builddir/build/BUILD/GIT/coderay/test/unit/debug.rb:37:in `test_filtering_text_tokens' 34: 35: def test_filtering_text_tokens 36: assert_equal TEST_OUTPUT, CodeRay::Encoders::Debug.new.encode_tokens(TEST_INPUT) => 37: assert_equal TEST_OUTPUT, TEST_INPUT.debug 38: end 39: 40: end =========================================================================================================================================================================== .................................E =========================================================================================================================================================================== Error: test_filtering_text_tokens(StatisticEncoderTest): NoMethodError: undefined method `statistic' for ["10", :integer, "(\\)", :operator, :begin_group, :string, "test", :content, :end_group, :string, :begin_line, :test, "\n", :space, "\n \t", :space, " \n", :space, "[]", :method, :end_line, :test]:Array /builddir/build/BUILD/GIT/coderay/test/unit/statistic.rb:56:in `test_filtering_text_tokens' 53: 54: def test_filtering_text_tokens 55: assert_equal TEST_OUTPUT, CodeRay::Encoders::Statistic.new.encode_tokens(TEST_INPUT) => 56: assert_equal TEST_OUTPUT, TEST_INPUT.statistic 57: end 58: 59: end =========================================================================================================================================================================== .............. Finished in 0.07171167 seconds. --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 53 tests, 161 assertions, 0 failures, 2 errors, 0 pendings, 0 omissions, 0 notifications 96.2264% passed
Note that the above output (error ) says:
NoMethodError: undefined method `debug' for ["10", :integer, "(\\)", :operator, :begin_group, :string, "test", :content, :end_group, :string, :begin_line, :head, "\n", :space, "\n \t", :space, " \n", :space, "[]", :method, :end_line, :head]:Array
despite TEST_INPUT is expected to be class of CodeRay::Tokens.
TEST_INPUT
CodeRay::Tokens
As far as I examined this, this is due to this change: https://bugs.ruby-lang.org/issues/6087 https://github.com/ruby/ruby/pull/3690
i.e. with ruby 3.0, for object of subclass of Array, the result of flatten method now becomes class of Array, not class of the subclass.
flatten
Test suite of coderay executes test/unit/suite.rb, whic fails with ruby 3.0:
Note that the above output (error ) says:
despite
TEST_INPUT
is expected to be class ofCodeRay::Tokens
.As far as I examined this, this is due to this change:
https://bugs.ruby-lang.org/issues/6087
https://github.com/ruby/ruby/pull/3690
i.e. with ruby 3.0, for object of subclass of Array, the result of
flatten
method now becomes class of Array, not class of the subclass.