Skip to content

Commit

Permalink
Merge pull request #10005 from keymanapp/fix/common/10004-truthful-te…
Browse files Browse the repository at this point in the history
…st-epic-ldml

fix(common): dx: don't call exit(0) on failure  🙀
  • Loading branch information
srl295 authored Nov 15, 2023
2 parents a355721 + ee39543 commit 6a305ca
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
6 changes: 3 additions & 3 deletions common/include/test_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<< console_color::reset() \
<< std::endl \
<< " " << (exprText) << std::endl; \
std::exit(100*__LINE__+(result)); \
std::exit(EXIT_FAILURE); \
}

#ifdef try_status
Expand Down Expand Up @@ -55,7 +55,7 @@
<< std::endl \
<< "expected: " << (expected) << std::endl \
<< "actual: " << (actual) << std::endl; \
std::exit(100*__LINE__); \
std::exit(EXIT_FAILURE); \
} \
}

Expand All @@ -70,6 +70,6 @@
<< std::endl \
<< "expected: " << Debug_UnicodeString((PKMX_WCHAR)(expected)) << std::endl \
<< "actual: " << Debug_UnicodeString((PKMX_WCHAR)(actual)) << std::endl; \
std::exit(100*__LINE__); \
std::exit(EXIT_FAILURE); \
} \
}
2 changes: 1 addition & 1 deletion core/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fi

# -------------------------------------------------------------------------------

testparams="${builder_extra_params[@]}"
testparams="${builder_extra_params[@]} --print-errorlogs"
if builder_has_option --test; then
testparams="$opt_tests $testparams"
fi
Expand Down
19 changes: 19 additions & 0 deletions core/src/debuglog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,25 @@ const char *Debug_UnicodeString(::std::u16string s, int x) {
return bufout[x];
}

const char *Debug_UnicodeString(::std::u32string s, int x) {
if (!ShouldDebug()) {
return "";
}
#ifdef _MSC_VER
__declspec(thread)
#endif
static char bufout[2][MEDIUM_BUF_SIZ];
auto p = s.begin();
char *q;
bufout[x][0] = 0;
for (q = bufout[x]; (intptr_t)(q-bufout[x]) < (128*7) && p != s.end(); p++)
{
snprintf(q, MEDIUM_BUF_SIZ - (q - bufout[x]), "U+%4.6X ", (unsigned int)*p);
q = strchr(q, 0);
}
return bufout[x];
}

void write_console(KMX_BOOL error, const wchar_t *fmt, ...) {
if (!g_silent || error) {
va_list vars;
Expand Down
1 change: 1 addition & 0 deletions core/src/debuglog.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const char *Debug_UnicodeString(PKMX_WCHAR s, int x = 0);
* @return pointer to temporary buffer
*/
const char *Debug_UnicodeString(std::u16string s, int x = 0);
const char *Debug_UnicodeString(std::u32string s, int x = 0);
const char *Debug_ModifierName(KMX_UINT modifiers);

inline KMX_BOOL ShouldDebug() {
Expand Down

0 comments on commit 6a305ca

Please sign in to comment.