From ece0d25c2b64b1bc1f1b4b6343a7f5b909d75f06 Mon Sep 17 00:00:00 2001 From: Henrik Nygren Date: Wed, 25 Feb 2015 14:28:08 +0200 Subject: Fix a backtracking problem in String#truncate_words Fixes #19070. --- activesupport/test/core_ext/string_ext_test.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 24037c665a..ac5a959409 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -249,6 +249,15 @@ class StringInflectionsTest < ActiveSupport::TestCase assert_equal "Hello
Big
World!", "Hello
Big
World!".truncate_words(3, :omission => "[...]", :separator => '
') end + def test_truncate_words_with_complex_string + Timeout.timeout(10) do + complex_string = "aa aa aaa aa aaa aaa aaa aa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaaa aaaaa aaaaa aaaaaa aa aa aa aaa aa aaa aa aa aa aa a aaa aaa \n a aaa <