相关文章推荐

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with some test in unity, I find there is a function named UnityPrint used in unity_run_single_test to print test name

static void unity_run_single_test(const test_desc_t *test)
    UnityPrint("Running ");
    UnityPrint(test->name);

and in UnityPrint function, I see there use UnityPrintChar to print each char in string

void UnityPrint(const char* string)
    const char* pch = string;
    if (pch != NULL)
        while (*pch)
            UnityPrintChar(pch);
            pch++;

finally, when I looked into UnityPrintChar function, I find it print Non-ASCII char in \xabcd format

static void UnityPrintChar(const char* pch)
    /* unprintable characters are shown as codes */
        UNITY_OUTPUT_CHAR('\\');
        UNITY_OUTPUT_CHAR('x');
        UnityPrintNumberHex((UNITY_UINT)*pch, 2);

is there a way to show test name in unicode, rather than this format?

for example:
test name: 常规测试 (which means normal test)
unity print: \xE5\xB8\xB8\xE8\xA7\x84\xE6\xB5\x8B\xE8\xAF\x95 (which is unreadable)

yeah, printf can print those unicode normally, but In some function like unity_run_all_tests or unity_run_menu,

I can not controller the print function to use printf replace UnityPrint or UnityPrintChar ,

so is there a example to allow this feature, or I just replace the source code to achieve this?

 
推荐文章