Skip to content

Commit 660a97b

Browse files
danbevrichardlau
authored andcommitted
test: suppress warning in test_environment.cc
Currently there is a compiler warning generated if a build defines NDEBUG: $ env CXXFLAGS='-DNDEBUG' make -j8 cctest ../test/cctest/test_environment.cc: In function ‘void at_exit_js(void*)’: ../test/cctest/test_environment.cc:333:25: warning: variable ‘obj’ set but not used [-Wunused-but-set-variable] 333 | v8::Local<v8::Object> obj = v8::Object::New(isolate); | ^~~ NDEBUG is currently not defined using the main branch but this discovered when working on replacing OpenSSL 1.1.1 with OpenSSL 3.0. This commit uses EXPECT statements instead of asserts to avoid the warning. PR-URL: #38868 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent cd3305a commit 660a97b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/cctest/test_environment.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,8 @@ static void at_exit_js(void* arg) {
341341
v8::Isolate* isolate = static_cast<v8::Isolate*>(arg);
342342
v8::HandleScope handle_scope(isolate);
343343
v8::Local<v8::Object> obj = v8::Object::New(isolate);
344-
assert(!obj.IsEmpty()); // Assert VM is still alive.
345-
assert(obj->IsObject());
344+
EXPECT_FALSE(obj.IsEmpty()); // Assert VM is still alive.
345+
EXPECT_TRUE(obj->IsObject());
346346
called_at_exit_js = true;
347347
}
348348

0 commit comments

Comments
 (0)