Skip to content

Commit d96cc9f

Browse files
committed
add test
1 parent 0873197 commit d96cc9f

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/testio.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4791,6 +4791,18 @@ class TestIO : public TestFixture {
47914791
"[test.cpp:17:5]: (warning) %s in format string (no. 5) requires 'char *' but the argument type is 'signed int'. [invalidPrintfArgType_s]\n"
47924792
"[test.cpp:17:5]: (warning) sprintf_s format string requires 5 parameters but 6 are given. [wrongPrintfScanfArgNum]\n", errout_str());
47934793

4794+
check("int main()\n"
4795+
"{\n"
4796+
" double value = 3.14;\n"
4797+
" const size_t buffer_size = 64;\n"
4798+
" char buffer[buffer_size];\n"
4799+
" int precision = 2;\n"
4800+
" _locale_t locale = _create_locale(LC_ALL, \"C\");\n"
4801+
" _sprintf_s_l(buffer, buffer_size, \"%.*f\", locale, precision, value);\n"
4802+
" _free_locale(locale);\n"
4803+
" return 0;\n"
4804+
"}\n");
4805+
ASSERT_EQUALS("", errout_str());
47944806
}
47954807

47964808
void testMicrosoftSecureScanfArgument() {

0 commit comments

Comments
 (0)