From 07f82f5b11165defd7ecdc7eba2ee903180a005e Mon Sep 17 00:00:00 2001 From: Liu Date: Thu, 7 Dec 2023 23:01:06 +0800 Subject: [PATCH] refactor: clear compiler warnings --- lib/css/tests/test_css_computed.c | 2 +- lib/i18n/tests/test.c | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/css/tests/test_css_computed.c b/lib/css/tests/test_css_computed.c index c2d10c972..a83ea6fea 100644 --- a/lib/css/tests/test_css_computed.c +++ b/lib/css/tests/test_css_computed.c @@ -9,7 +9,7 @@ static void check_length(const char *str, css_numeric_value_t actual, ctest_equal_int(str, (int)actual, (int)expected); } -static test_button_focus_style(void) +static void test_button_focus_style(void) { css_selector_t *selector; css_style_decl_t *result; diff --git a/lib/i18n/tests/test.c b/lib/i18n/tests/test.c index 7d63db24c..2c941cb5b 100644 --- a/lib/i18n/tests/test.c +++ b/lib/i18n/tests/test.c @@ -5,6 +5,8 @@ void test_i18n(void) { size_t len; wchar_t lang[32]; + wchar_t text_ok[] = {30830, 23450, 0}; + wchar_t text_cn[] = {20013, 25991, 0}; len = i18n_detect_language(lang, 32); ctest_equal_bool("i18n_detect_language()", len > 0, true); @@ -22,29 +24,29 @@ void test_i18n(void) i18n_change_language(L"en"); - ctest_equal_bool("i18n_translate(L\"name\") == L\"English\")", + ctest_equal_bool("en: i18n_translate(L\"name\") == L\"English\")", wcscmp(i18n_translate(L"name"), L"English") == 0, true); - ctest_equal_bool("i18n_translate(L\"button.ok\") == L\"Ok\")", + ctest_equal_bool("en: i18n_translate(L\"button.ok\") == L\"Ok\")", wcscmp(i18n_translate(L"button.ok"), L"Ok") == 0, true); - ctest_equal_bool("i18n_translate(L\"button.notfound\") == NULL)", + ctest_equal_bool("en: i18n_translate(L\"button.notfound\") == NULL)", i18n_translate(L"button.notfound")== NULL, true); i18n_change_language(L"zh-CN"); - ctest_equal_bool("i18n_translate(L\"name\") == L\"中文\")", - wcscmp(i18n_translate(L"name"), L"中文") == 0, + ctest_equal_bool("zh-CN: i18n_translate(L\"name\")", + wcscmp(i18n_translate(L"name"), text_cn) == 0, true); - ctest_equal_bool("i18n_translate(L\"button.ok\") == L\"确定\")", - wcscmp(i18n_translate(L"button.ok"), L"确定") == 0, + ctest_equal_bool("zh-CN: i18n_translate(L\"button.ok\")", + wcscmp(i18n_translate(L"button.ok"), text_ok) == 0, true); - ctest_equal_bool("i18n_translate(L\"button.notfound\") == NULL)", + ctest_equal_bool("zh-CN: i18n_translate(L\"button.notfound\") == NULL", i18n_translate(L"button.notfound")== NULL, true); i18n_clear();