Fix test suite for ruby 3.0 change for methods on subclass of Array

With ruby 3.0, especially with https://github.com/ruby/ruby/pull/3690 ,
for subclass of Array, `flatten` method now returns the instance of Array,
not of the subclass.

To keep the object instance of the subclass, use `flatten!` instead.
This commit is contained in:
Mamoru TASAKA 2021-02-21 23:04:03 +09:00
parent 8f4254b2b8
commit c1c1503474
2 changed files with 5 additions and 3 deletions

View File

@ -24,7 +24,8 @@ class DebugEncoderTest < Test::Unit::TestCase
[" \n", :space],
["[]", :method],
[:end_line, :head],
].flatten
]
TEST_INPUT.flatten!
TEST_OUTPUT = <<-'DEBUG'.chomp
integer(10)operator((\\\))string<content(test)>head[

View File

@ -24,7 +24,8 @@ class StatisticEncoderTest < Test::Unit::TestCase
[" \n", :space],
["[]", :method],
[:end_line, :test],
].flatten
]
TEST_INPUT.flatten!
TEST_OUTPUT = <<-'DEBUG'
Code Statistics
@ -56,4 +57,4 @@ Token Types (7):
assert_equal TEST_OUTPUT, TEST_INPUT.statistic
end
end
end