Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c1c1503

Browse files
committed
Fix test suite for ruby 3.0 change for methods on subclass of Array
With ruby 3.0, especially with ruby/ruby#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.
1 parent 8f4254b commit c1c1503

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

test/unit/debug.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def test_creation
2424
[" \n", :space],
2525
["[]", :method],
2626
[:end_line, :head],
27-
].flatten
27+
]
28+
TEST_INPUT.flatten!
2829
TEST_OUTPUT = <<-'DEBUG'.chomp
2930
integer(10)operator((\\\))string<content(test)>head[
3031

test/unit/statistic.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def test_creation
2424
[" \n", :space],
2525
["[]", :method],
2626
[:end_line, :test],
27-
].flatten
27+
]
28+
TEST_INPUT.flatten!
2829
TEST_OUTPUT = <<-'DEBUG'
2930
3031
Code Statistics
@@ -56,4 +57,4 @@ def test_filtering_text_tokens
5657
assert_equal TEST_OUTPUT, TEST_INPUT.statistic
5758
end
5859

59-
end
60+
end

0 commit comments

Comments
 (0)