summaryrefslogtreecommitdiff
path: root/test/gjs-tests.cpp
diff options
context:
space:
mode:
authorPhilip Chimento <philip.chimento@gmail.com>2020-11-20 16:34:01 -0800
committerPhilip Chimento <philip.chimento@gmail.com>2020-11-22 15:10:14 -0800
commitf89e0586e004aa32607219e6d7f0d1d1fbbe8fb3 (patch)
tree6d54f50b049a1dff7aea8aa8c960ae57022acd15 /test/gjs-tests.cpp
parent95a48ca23c090d4058d3a0cc89f7e4cff39521a8 (diff)
downloadgjs-f89e0586e004aa32607219e6d7f0d1d1fbbe8fb3.tar.gz
maint: Move expressions with side-effects out of assert statements
A newer version of cppcheck catches this.
Diffstat (limited to 'test/gjs-tests.cpp')
-rw-r--r--test/gjs-tests.cpp6
1 files 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");