ICU-4567 Fix last change so that it works on Windows.

X-SVN-Rev: 22421
This commit is contained in:
George Rhoten 2007-08-19 07:00:36 +00:00
parent 065cbd88e5
commit 10b81c7930
3 changed files with 13 additions and 14 deletions

View File

@ -221,7 +221,8 @@ void DataDrivenFormatTest::testConvertDate(TestData *testData,
if(output == expectStr) {
logln(caseString+": format: SUCCESS! "+UnicodeString("expect=output=")+output);
} else {
errln(caseString+": format: output!=expectStr, got " + udbg_escape(output) + " expected " + udbg_escape(expectStr));
UnicodeString result;
errln(caseString+": format: output!=expectStr, got " + *udbg_escape(output, &result) + " expected " + *udbg_escape(expectStr, &result));
}
} else {
cal->clear();

View File

@ -11,6 +11,7 @@
#include "unicode/unistr.h"
#include "unicode/ustring.h"
#include "util.h"
#include "ucln.h"
#include <stdio.h>
@ -117,22 +118,19 @@ udbg_stoi(const UnicodeString &s)
return atoi(ch);
}
// from incaltst.cpp
T_CTEST_API UnicodeString
udbg_escape(const UnicodeString &src)
T_CTEST_API UnicodeString *
udbg_escape(const UnicodeString &src, UnicodeString *dst)
{
UnicodeString dst;
dst.remove();
dst->remove();
for (int32_t i = 0; i < src.length(); ++i) {
UChar c = src[i];
if(c < 0x0080)
dst += c;
if(ICU_Utility::isUnprintable(c)) {
*dst += UnicodeString("[");
ICU_Utility::escapeUnprintable(*dst, c);
*dst += UnicodeString("]");
}
else {
dst += UnicodeString("[");
char buf [8];
sprintf(buf, "%#x", c);
dst += UnicodeString(buf);
dst += UnicodeString("]");
*dst += c;
}
}

View File

@ -31,7 +31,7 @@ T_CTEST_API int32_t T_CTEST_EXPORT2 udbg_enumByString(UDebugEnumType type, cons
*/
T_CTEST_API int32_t T_CTEST_EXPORT2 udbg_stoi(const UnicodeString &s);
T_CTEST_API UnicodeString udbg_escape(const UnicodeString &s);
T_CTEST_API UnicodeString *udbg_escape(const UnicodeString &s, UnicodeString *dst);
#endif