Refactor SectionInfo constructors

This commit is contained in:
Martin Hořeňovský
2019-11-16 21:53:32 +01:00
parent d36c15c3ca
commit c9067b2253
11 changed files with 47 additions and 37 deletions

View File

@@ -1,19 +0,0 @@
/*
* Created by Martin on 01/08/2017.
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#include "catch_section_info.h"
namespace Catch {
SectionInfo::SectionInfo
( SourceLineInfo const& _lineInfo,
std::string const& _name )
: name( _name ),
lineInfo( _lineInfo )
{}
} // end namespace Catch

View File

@@ -17,17 +17,14 @@
namespace Catch {
struct SectionInfo {
SectionInfo
( SourceLineInfo const& _lineInfo,
std::string const& _name );
// The last argument is ignored, so that people can write
// SECTION("ShortName", "Proper description that is long") and
// still use the `-c` flag comfortably.
SectionInfo
( SourceLineInfo const& _lineInfo,
std::string const& _name,
const char* const ) : SectionInfo( _lineInfo, _name ) {}
SectionInfo( SourceLineInfo const& _lineInfo, std::string _name,
const char* const = nullptr ):
name(std::move(_name)),
lineInfo(_lineInfo)
{}
std::string name;
SourceLineInfo lineInfo;