ladybird/Tests/AK/TestOwnPtr.cpp
Andreas Kling 079af3d120 AK: Remove custom deleters from OwnPtr
OwnPtr now always deletes the owned object directly from clear(). Remove
the unused deleter template parameter and the DefaultDelete helper that
only supported that parameter. Drop the dedicated custom deleter test.
2026-06-13 22:49:15 +02:00

21 lines
439 B
C++

/*
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibTest/TestCase.h>
#include <AK/OwnPtr.h>
TEST_CASE(destroy_self_owning_object)
{
struct SelfOwning {
OwnPtr<SelfOwning> self;
};
OwnPtr<SelfOwning> object = make<SelfOwning>();
auto* object_ptr = object.ptr();
object->self = move(object);
object = nullptr;
object_ptr->self = nullptr;
}