+void MessageFormatRegressionTest::TestICU12584() {
+ // We were able to handle only 10 due to the bug ICU-12584.
+ UnicodeString pattern(
+ u"{1}{2}{3}{1}{2}{3}{1}{2}{3}{1}{2}{3}{1}{2}{3}{1}{2}{3}{1}{2}{3}{1}"
+ u"{2}{3}{1}{2}{3}{1}{2}{3}{1}{2}{3}{1}{2}{3}{1}{2}{3}{1}{2}{3}");
+
+ UErrorCode status = U_ZERO_ERROR;
+
+ MessageFormat msg(pattern, status);
+ failure(status, "Flat message");
+
+ int32_t count;
+ msg.getFormats(count);
+ assertEquals("Plain placeholder match", 42, count);
+
+ // Make sure we iterate only over top level arguments (so we don't over allocate).
+ UnicodeString inner_pattern("{1}{1,select,fem {1} masc {2} other {3}}{2}");
+ status = U_ZERO_ERROR;
+ MessageFormat inner_msg(inner_pattern, status);
+ failure(status, "Inner message");
+
+ count = 0;
+ inner_msg.getFormats(count);
+ assertEquals("Inner placeholder match", 3, count);
+}
+