Quellcode durchsuchen

Refactoring.

main
offa vor 7 Jahren
Ursprung
Commit
b9b7126260
2 geänderte Dateien mit 14 neuen und 12 gelöschten Zeilen
  1. +8
    -3
      test/ScopeGuardTest.cpp
  2. +6
    -9
      test/UniqueResourceTest.cpp

+ 8
- 3
test/ScopeGuardTest.cpp Datei anzeigen

@@ -20,13 +20,18 @@

#include "scope_guard.h"
#include <catch.hpp>
#include "Mocks.h"
#include <trompeloeil.hpp>

using namespace trompeloeil;

namespace
{
mock::CallMock m;
struct CallMock
{
MAKE_MOCK0(deleter, void());
};

CallMock m;

void deleter()
{
@@ -51,7 +56,7 @@ TEST_CASE("deleter is not called if released", "[ScopeGuard]")

TEST_CASE("deleter lambda called on destruction", "[ScopeGuard]")
{
mock::CallMock cm;
CallMock cm;
REQUIRE_CALL(cm, deleter());
auto guard = sr::scope_guard([&cm] { cm.deleter(); });
static_cast<void>(guard);

+ 6
- 9
test/UniqueResourceTest.cpp Datei anzeigen

@@ -25,21 +25,18 @@

using namespace trompeloeil;

using Handle = int;
using PtrHandle = std::add_pointer_t<Handle>;

namespace mock
namespace
{
using Handle = int;
using PtrHandle = std::add_pointer_t<Handle>;


struct CallMock
{
MAKE_MOCK1(deleter, void(Handle));
};
}


namespace
{
mock::CallMock m;
CallMock m;

void deleter(Handle h)
{

Laden…
Abbrechen
Speichern