- wxString result = wxConvertFormat(input);
- wxString msg = _T("input: '") + input +
- _T("', result: '") + result +
- _T("', expected: '") + expected + _T("'");
- CPPUNIT_ASSERT_MESSAGE(string(msg.mb_str()), result == expected);
+ // all of them are unused in some build configurations
+ wxUnusedVar(expectedScanf);
+ wxUnusedVar(expectedUtf8);
+ wxUnusedVar(expectedWcharUnix);
+ wxUnusedVar(expectedWcharWindows);
+
+ wxString result, msg;
+
+#ifndef __WINDOWS__
+ // on windows, wxScanf() string needs no modifications
+ result = wxScanfConvertFormatW(input.wc_str());
+
+ msg = _T("input: '") + input +
+ _T("', result (scanf): '") + result +
+ _T("', expected: '") + expectedScanf + _T("'");
+ CPPUNIT_ASSERT_MESSAGE(string(msg.mb_str()), result == expectedScanf);
+#endif // !__WINDOWS__
+
+#if wxUSE_UNICODE_UTF8
+ result = (const char*)wxFormatString(input);
+
+ msg = _T("input: '") + input +
+ _T("', result (UTF-8): '") + result +
+ _T("', expected: '") + expectedUtf8 + _T("'");
+ CPPUNIT_ASSERT_MESSAGE(string(msg.mb_str()), result == expectedUtf8);
+#endif // wxUSE_UNICODE_UTF8
+
+#if wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY
+ result = (const wchar_t*)wxFormatString(input);
+
+#ifdef __WINDOWS__
+ wxString expectedWchar(expectedWcharWindows);
+#else
+ wxString expectedWchar(expectedWcharUnix);
+#endif
+
+ msg = _T("input: '") + input +
+ _T("', result (wchar_t): '") + result +
+ _T("', expected: '") + expectedWchar + _T("'");
+ CPPUNIT_ASSERT_MESSAGE(string(msg.mb_str()), result == expectedWchar);
+#endif // wxUSE_UNICODE && !wxUSE_UTF8_LOCALE_ONLY