Browse Source

Class name typo fixed (#147).

main
offa 6 years ago
parent
commit
21383753f9
2 changed files with 8 additions and 8 deletions
  1. +6
    -6
      test/CallMocks.h
  2. +2
    -2
      test/UniqueResourceTest.cpp

+ 6
- 6
test/CallMocks.h View File

}; };




struct ConditialThrowOnCopyMock
struct ConditionalThrowOnCopyMock
{ {
explicit ConditialThrowOnCopyMock(Handle h, bool throwOnCopyMock) : handle(h),
explicit ConditionalThrowOnCopyMock(Handle h, bool throwOnCopyMock) : handle(h),
shouldThrow(throwOnCopyMock) shouldThrow(throwOnCopyMock)
{ {
} }


ConditialThrowOnCopyMock(const ConditialThrowOnCopyMock& other) : handle(other.handle),
ConditionalThrowOnCopyMock(const ConditionalThrowOnCopyMock& other) : handle(other.handle),
shouldThrow(other.shouldThrow) shouldThrow(other.shouldThrow)
{ {
if( shouldThrow == true ) if( shouldThrow == true )
} }
} }


ConditialThrowOnCopyMock(ConditialThrowOnCopyMock&&) = default;
ConditionalThrowOnCopyMock(ConditionalThrowOnCopyMock&&) = default;


ConditialThrowOnCopyMock& operator=(const ConditialThrowOnCopyMock& other)
ConditionalThrowOnCopyMock& operator=(const ConditionalThrowOnCopyMock& other)
{ {
if( &other != this ) if( &other != this )
{ {
return *this; return *this;
} }


ConditialThrowOnCopyMock& operator=(ConditialThrowOnCopyMock&&) = default;
ConditionalThrowOnCopyMock& operator=(ConditionalThrowOnCopyMock&&) = default;




Handle handle; Handle handle;

+ 2
- 2
test/UniqueResourceTest.cpp View File

REQUIRE_CALL(m, deleter(3)); REQUIRE_CALL(m, deleter(3));
REQUIRE_CALL(m, deleter(7)); REQUIRE_CALL(m, deleter(7));
auto d = [](const auto& v) { deleter(v.handle); }; auto d = [](const auto& v) { deleter(v.handle); };
auto guard = sr::unique_resource{ConditialThrowOnCopyMock{3, false}, d};
guard.reset(ConditialThrowOnCopyMock{7, true});
auto guard = sr::unique_resource{ConditionalThrowOnCopyMock{3, false}, d};
guard.reset(ConditionalThrowOnCopyMock{7, true});
} }


TEST_CASE("release disables deleter", "[UniqueResource]") TEST_CASE("release disables deleter", "[UniqueResource]")

Loading…
Cancel
Save