[gjs: 1/16] maint: Move expressions with side-effects out of assert statements
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/16] maint: Move expressions with side-effects out of assert statements
- Date: Mon, 23 Nov 2020 18:24:47 +0000 (UTC)
commit f89e0586e004aa32607219e6d7f0d1d1fbbe8fb3
Author: Philip Chimento <philip chimento gmail com>
Date: Fri Nov 20 16:34:01 2020 -0800
maint: Move expressions with side-effects out of assert statements
A newer version of cppcheck catches this.
test/gjs-tests.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/test/gjs-tests.cpp b/test/gjs-tests.cpp
index 95eec163..4bf7b78e 100644
--- a/test/gjs-tests.cpp
+++ b/test/gjs-tests.cpp
@@ -281,7 +281,8 @@ static void test_jsapi_util_string_char16_data(GjsUnitTestFixture* fx,
/* Try with a string that is likely to be stored as Latin-1 */
str = JS_NewStringCopyZ(fx->cx, "abcd");
- g_assert_true(gjs_string_get_char16_data(fx->cx, str, &chars, &len));
+ bool ok = gjs_string_get_char16_data(fx->cx, str, &chars, &len);
+ g_assert_true(ok);
result.assign(chars, len);
g_assert_true(result == u"abcd");
@@ -303,7 +304,8 @@ static void test_jsapi_util_string_to_ucs4(GjsUnitTestFixture* fx,
/* Try with a string that is likely to be stored as Latin-1 */
str = JS_NewStringCopyZ(fx->cx, "abcd");
- g_assert_true(gjs_string_to_ucs4(fx->cx, str, &chars, &len));
+ bool ok = gjs_string_to_ucs4(fx->cx, str, &chars, &len);
+ g_assert_true(ok);
result.assign(chars, chars + len);
g_assert_true(result == U"abcd");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]