Skip to content

Commit

Permalink
test: fix coverity UNINIT_CTOR cctest warning
Browse files Browse the repository at this point in the history
Explicitly initialize `platform_` to nullptr.  Coverity cannot divine
it is set and cleared by the Setup() and TearDown() methods.

PR-URL: #12387
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
bnoordhuis authored and jasnell committed Apr 18, 2017
1 parent 4fc1199 commit 6c912a8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/cctest/node_test_fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ class NodeTestFixture : public ::testing::Test {
ArrayBufferAllocator allocator_;
v8::Isolate* isolate_;

~NodeTestFixture() {
TearDown();
}

virtual void SetUp() {
platform_ = v8::platform::CreateDefaultPlatform();
v8::V8::InitializePlatform(platform_);
Expand All @@ -88,13 +92,14 @@ class NodeTestFixture : public ::testing::Test {
}

virtual void TearDown() {
if (platform_ == nullptr) return;
v8::V8::ShutdownPlatform();
delete platform_;
platform_ = nullptr;
}

private:
v8::Platform* platform_;
v8::Platform* platform_ = nullptr;
};

#endif // TEST_CCTEST_NODE_TEST_FIXTURE_H_

0 comments on commit 6c912a8

Please sign in to comment.