+static void TestMessageWithUnusedArgNumber(void) {
+ UErrorCode errorCode = U_ZERO_ERROR;
+ U_STRING_DECL(pattern, "abc {1} def", 11);
+ UChar x[2] = { 0x78, 0 }; // "x"
+ UChar y[2] = { 0x79, 0 }; // "y"
+ U_STRING_DECL(expected, "abc y def", 9);
+ UChar result[20];
+ int32_t length;
+
+ U_STRING_INIT(pattern, "abc {1} def", 11);
+ U_STRING_INIT(expected, "abc y def", 9);
+ length = u_formatMessage("en", pattern, -1, result, UPRV_LENGTHOF(result), &errorCode, x, y);
+ if (U_FAILURE(errorCode) || length != u_strlen(expected) || u_strcmp(result, expected) != 0) {
+ log_err("u_formatMessage(pattern with only {1}, 2 args) failed: result length %d, UErrorCode %s \n",
+ (int)length, u_errorName(errorCode));
+ }
+}
+