Skip to content

Commit 91c05d5

Browse files
headiuszeha
authored andcommitted
[PATCH] test/ruby/test_array.rb: split permute + stack error tests out.
* test/ruby/test_array.rb: split out the test for no stack error on large input for test_permutation, test_repeated_permutation, and test_repeated_combination, and make them all timeout:30. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e [[email protected]: backport from trunk]
1 parent 8e509ec commit 91c05d5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/ruby/test_array.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,9 @@ def test_permutation
18191819

18201820
bug3708 = '[ruby-dev:42067]'
18211821
assert_equal(b, @cls[0, 1, 2, 3, 4][1, 4].permutation.to_a, bug3708)
1822+
end
18221823

1824+
def test_permutation_stack_error
18231825
bug9932 = '[ruby-core:63103] [Bug #9932]'
18241826
assert_separately([], <<-"end;") # do
18251827
assert_nothing_raised(SystemStackError, "#{bug9932}") do
@@ -1851,8 +1853,10 @@ def test_repeated_permutation
18511853

18521854
a = @cls[0, 1, 2, 3, 4][1, 4].repeated_permutation(2)
18531855
assert_empty(a.reject {|x| !x.include?(0)})
1856+
end
18541857

1855-
assert_separately([], <<-"end;") # do
1858+
def test_repeated_permutation_stack_error
1859+
assert_separately([], <<-"end;", timeout: 30) # do
18561860
assert_nothing_raised(SystemStackError) do
18571861
assert_equal(:ok, Array.new(100_000, nil).repeated_permutation(500_000) {break :ok})
18581862
end
@@ -1886,8 +1890,10 @@ def test_repeated_combination
18861890

18871891
a = @cls[0, 1, 2, 3, 4][1, 4].repeated_combination(2)
18881892
assert_empty(a.reject {|x| !x.include?(0)})
1893+
end
18891894

1890-
assert_separately([], <<-"end;") # do
1895+
def test_repeated_combination_stack_error
1896+
assert_separately([], <<-"end;", timeout: 20) # do
18911897
assert_nothing_raised(SystemStackError) do
18921898
assert_equal(:ok, Array.new(100_000, nil).repeated_combination(500_000) {break :ok})
18931899
end

0 commit comments

Comments
 (0)