mirror of
https://github.com/catchorg/Catch2.git
synced 2025-06-07 07:51:00 +00:00
Simplified test case registration and started using StringRefs
This commit is contained in:
parent
79627cdcdb
commit
720fdf1d02
4 changed files with 44 additions and 80 deletions
|
@ -12,13 +12,17 @@
|
|||
|
||||
#include <cstring>
|
||||
#include <ostream>
|
||||
#include <cassert>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
StringRef StringRef::s_emptyStringRef = "";
|
||||
|
||||
auto getEmptyStringRef() -> StringRef {
|
||||
static StringRef s_emptyStringRef("");
|
||||
return s_emptyStringRef;
|
||||
}
|
||||
|
||||
StringRef::StringRef() noexcept
|
||||
: StringRef( s_emptyStringRef )
|
||||
: StringRef( getEmptyStringRef() )
|
||||
{}
|
||||
|
||||
StringRef::StringRef( StringRef const& other ) noexcept
|
||||
|
@ -41,7 +45,9 @@ namespace Catch {
|
|||
StringRef::StringRef( char const* rawChars ) noexcept
|
||||
: m_start( rawChars ),
|
||||
m_size( static_cast<size_type>( std::strlen( rawChars ) ) )
|
||||
{}
|
||||
{
|
||||
assert( rawChars != nullptr );
|
||||
}
|
||||
|
||||
StringRef::StringRef( char const* rawChars, size_type size ) noexcept
|
||||
: m_start( rawChars ),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue