[SERVER-6912] Use smart pointers in dbtests/jstests.cpp for Scope variables Created: 31/Aug/12  Updated: 29/Oct/15  Resolved: 29/Oct/15

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Andrew Emil (Inactive) Assignee: Unassigned
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Participants:

 Description   

In dbtests/jstests.cpp many of the tests have something like:

Scope * s = globalScopeEngine->newScope();
...
delete s;

This should be changed so that instead of having a normal pointer for s, we use a smart pointer. This also means that we will not have to have the delete call at the end of each test.

Though this method works, it is not exception safe and is not really in line with best practices. Additionally, it seems desirable to have consistency throughout the code base (even in tests) regarding the (non)use of delete



 Comments   
Comment by Kamran K. [ 29/Oct/15 ]

Fixed as part of SERVER-18531.

Generated at Thu Feb 08 03:13:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.