mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-23 13:05:39 +02:00
Use std::string_view
This commit is contained in:
@@ -109,10 +109,10 @@ and then `assertionEnded` event is emitted.
|
||||
> [Introduced](https://github.com/catchorg/Catch2/issues/1616) in Catch2 2.9.0.
|
||||
|
||||
```cpp
|
||||
void benchmarkPreparing( StringRef name ) override;
|
||||
void benchmarkPreparing( std::string_view name ) override;
|
||||
void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
|
||||
void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;
|
||||
void benchmarkFailed( StringRef error ) override;
|
||||
void benchmarkFailed( std::string_view error ) override;
|
||||
```
|
||||
|
||||
Due to the benchmark lifecycle being bit more complicated, the benchmarking
|
||||
@@ -153,9 +153,9 @@ void listTags( std::vector<TagInfo> const& tagInfos );
|
||||
## Miscellaneous events
|
||||
|
||||
```cpp
|
||||
void reportInvalidTestSpec( StringRef unmatchedSpec );
|
||||
void fatalErrorEncountered( StringRef error );
|
||||
void noMatchingTestCases( StringRef unmatchedSpec );
|
||||
void reportInvalidTestSpec( std::string_view unmatchedSpec );
|
||||
void fatalErrorEncountered( std::string_view error );
|
||||
void noMatchingTestCases( std::string_view unmatchedSpec );
|
||||
```
|
||||
|
||||
These are one-off events that do not neatly fit into other categories.
|
||||
|
@@ -131,7 +131,7 @@ void print( std::ostream& os, int const level, std::string const& title, Catch::
|
||||
}
|
||||
|
||||
// struct Tag {
|
||||
// StringRef original, lowerCased;
|
||||
// std::string_view original, lowerCased;
|
||||
// };
|
||||
//
|
||||
//
|
||||
@@ -221,9 +221,9 @@ void print( std::ostream& os, int const level, std::string const& title, Catch::
|
||||
|
||||
// struct AssertionInfo
|
||||
// {
|
||||
// StringRef macroName;
|
||||
// std::string_view macroName;
|
||||
// SourceLineInfo lineInfo;
|
||||
// StringRef capturedExpression;
|
||||
// std::string_view capturedExpression;
|
||||
// ResultDisposition::Flags resultDisposition;
|
||||
// };
|
||||
|
||||
|
@@ -124,7 +124,6 @@ set(IMPL_HEADERS
|
||||
${SOURCES_DIR}/internal/catch_stdstreams.hpp
|
||||
${SOURCES_DIR}/internal/catch_stream_end_stop.hpp
|
||||
${SOURCES_DIR}/internal/catch_string_manip.hpp
|
||||
${SOURCES_DIR}/internal/catch_stringref.hpp
|
||||
${SOURCES_DIR}/internal/catch_tag_alias_registry.hpp
|
||||
${SOURCES_DIR}/internal/catch_template_test_registry.hpp
|
||||
${SOURCES_DIR}/internal/catch_test_case_info_hasher.hpp
|
||||
@@ -201,7 +200,6 @@ set(IMPL_SOURCES
|
||||
${SOURCES_DIR}/internal/catch_startup_exception_registry.cpp
|
||||
${SOURCES_DIR}/internal/catch_stdstreams.cpp
|
||||
${SOURCES_DIR}/internal/catch_string_manip.cpp
|
||||
${SOURCES_DIR}/internal/catch_stringref.cpp
|
||||
${SOURCES_DIR}/internal/catch_tag_alias_registry.cpp
|
||||
${SOURCES_DIR}/internal/catch_test_case_info_hasher.cpp
|
||||
${SOURCES_DIR}/internal/catch_test_case_registry_impl.cpp
|
||||
|
@@ -106,7 +106,6 @@
|
||||
#include <catch2/internal/catch_stdstreams.hpp>
|
||||
#include <catch2/internal/catch_stream_end_stop.hpp>
|
||||
#include <catch2/internal/catch_string_manip.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_tag_alias_registry.hpp>
|
||||
#include <catch2/internal/catch_template_test_registry.hpp>
|
||||
#include <catch2/internal/catch_test_case_info_hasher.hpp>
|
||||
|
@@ -10,16 +10,17 @@
|
||||
|
||||
#include <catch2/internal/catch_result_type.hpp>
|
||||
#include <catch2/internal/catch_source_line_info.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <string_view>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct AssertionInfo {
|
||||
// AssertionInfo() = delete;
|
||||
|
||||
StringRef macroName;
|
||||
std::string_view macroName;
|
||||
SourceLineInfo lineInfo;
|
||||
StringRef capturedExpression;
|
||||
std::string_view capturedExpression;
|
||||
ResultDisposition::Flags resultDisposition;
|
||||
};
|
||||
|
||||
|
@@ -91,14 +91,14 @@ namespace Catch {
|
||||
: expr;
|
||||
}
|
||||
|
||||
StringRef AssertionResult::getMessage() const {
|
||||
std::string_view AssertionResult::getMessage() const {
|
||||
return m_resultData.message;
|
||||
}
|
||||
SourceLineInfo AssertionResult::getSourceInfo() const {
|
||||
return m_info.lineInfo;
|
||||
}
|
||||
|
||||
StringRef AssertionResult::getTestMacroName() const {
|
||||
std::string_view AssertionResult::getTestMacroName() const {
|
||||
return m_info.macroName;
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include <catch2/catch_assertion_info.hpp>
|
||||
#include <catch2/internal/catch_result_type.hpp>
|
||||
#include <catch2/internal/catch_source_line_info.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_lazy_expr.hpp>
|
||||
|
||||
#include <string>
|
||||
@@ -46,9 +45,9 @@ namespace Catch {
|
||||
std::string getExpressionInMacro() const;
|
||||
bool hasExpandedExpression() const;
|
||||
std::string getExpandedExpression() const;
|
||||
StringRef getMessage() const;
|
||||
std::string_view getMessage() const;
|
||||
SourceLineInfo getSourceInfo() const;
|
||||
StringRef getTestMacroName() const;
|
||||
std::string_view getTestMacroName() const;
|
||||
|
||||
//protected:
|
||||
AssertionInfo m_info;
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#include <catch2/internal/catch_enforce.hpp>
|
||||
#include <catch2/internal/catch_parse_numbers.hpp>
|
||||
#include <catch2/internal/catch_stdstreams.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_string_manip.hpp>
|
||||
#include <catch2/internal/catch_test_spec_parser.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_tag_alias_registry.hpp>
|
||||
@@ -186,7 +185,7 @@ namespace Catch {
|
||||
|
||||
// IConfig interface
|
||||
bool Config::allowThrows() const { return !m_data.noThrow; }
|
||||
StringRef Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
|
||||
std::string_view Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
|
||||
bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; }
|
||||
bool Config::warnAboutMissingAssertions() const {
|
||||
return !!( m_data.warnings & WarnAbout::NoAssertions );
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include <catch2/catch_test_spec.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_config.hpp>
|
||||
#include <catch2/internal/catch_unique_ptr.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_random_seed_generation.hpp>
|
||||
#include <catch2/internal/catch_reporter_spec_parser.hpp>
|
||||
|
||||
@@ -115,7 +114,7 @@ namespace Catch {
|
||||
|
||||
// IConfig interface
|
||||
bool allowThrows() const override;
|
||||
StringRef name() const override;
|
||||
std::string_view name() const override;
|
||||
bool includeSuccessfulResults() const override;
|
||||
bool warnAboutMissingAssertions() const override;
|
||||
bool warnAboutUnmatchedTestSpecs() const override;
|
||||
|
@@ -35,10 +35,10 @@ namespace Catch {
|
||||
}
|
||||
|
||||
|
||||
Capturer::Capturer( StringRef macroName,
|
||||
Capturer::Capturer( std::string_view macroName,
|
||||
SourceLineInfo const& lineInfo,
|
||||
ResultWas::OfType resultType,
|
||||
StringRef names ):
|
||||
std::string_view names ):
|
||||
m_resultCapture( getResultCapture() ) {
|
||||
auto trimmed = [&] (size_t start, size_t end) {
|
||||
while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) {
|
||||
@@ -86,7 +86,7 @@ namespace Catch {
|
||||
if (start != pos && openings.empty()) {
|
||||
m_messages.emplace_back(macroName, lineInfo, resultType);
|
||||
m_messages.back().message += trimmed(start, pos);
|
||||
m_messages.back().message += " := "_sr;
|
||||
m_messages.back().message += " := ";
|
||||
start = pos;
|
||||
}
|
||||
break;
|
||||
@@ -96,7 +96,7 @@ namespace Catch {
|
||||
assert(openings.empty() && "Mismatched openings");
|
||||
m_messages.emplace_back(macroName, lineInfo, resultType);
|
||||
m_messages.back().message += trimmed(start, names.size() - 1);
|
||||
m_messages.back().message += " := "_sr;
|
||||
m_messages.back().message += " := ";
|
||||
}
|
||||
Capturer::~Capturer() {
|
||||
assert( m_captured == m_messages.size() );
|
||||
|
@@ -36,7 +36,7 @@ namespace Catch {
|
||||
};
|
||||
|
||||
struct MessageBuilder : MessageStream {
|
||||
MessageBuilder( StringRef macroName,
|
||||
MessageBuilder( std::string_view macroName,
|
||||
SourceLineInfo const& lineInfo,
|
||||
ResultWas::OfType type ):
|
||||
m_info(macroName, lineInfo, type) {}
|
||||
@@ -66,7 +66,7 @@ namespace Catch {
|
||||
IResultCapture& m_resultCapture;
|
||||
size_t m_captured = 0;
|
||||
public:
|
||||
Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names );
|
||||
Capturer( std::string_view macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, std::string_view names );
|
||||
|
||||
Capturer(Capturer const&) = delete;
|
||||
Capturer& operator=(Capturer const&) = delete;
|
||||
@@ -92,26 +92,26 @@ namespace Catch {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, std::string_view(), resultDisposition ); \
|
||||
catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \
|
||||
catchAssertionHandler.complete(); \
|
||||
} while( false )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \
|
||||
Catch::Capturer varName( macroName##_catch_sr, \
|
||||
Catch::Capturer varName( macroName, \
|
||||
CATCH_INTERNAL_LINEINFO, \
|
||||
Catch::ResultWas::Info, \
|
||||
#__VA_ARGS__##_catch_sr ); \
|
||||
#__VA_ARGS__ ); \
|
||||
varName.captureValues( 0, __VA_ARGS__ )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_INFO( macroName, log ) \
|
||||
const Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )
|
||||
const Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \
|
||||
Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )
|
||||
Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )
|
||||
|
||||
|
||||
#if defined(CATCH_CONFIG_PREFIX_MESSAGES) && !defined(CATCH_CONFIG_DISABLE)
|
||||
|
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||
#include <catch2/internal/catch_source_line_info.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/catch_totals.hpp>
|
||||
|
||||
#include <string>
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
#include <string_view>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@@ -47,28 +48,28 @@ namespace Catch {
|
||||
return tcp != TestCaseProperties::None;
|
||||
}
|
||||
|
||||
TestCaseProperties parseSpecialTag( StringRef tag ) {
|
||||
TestCaseProperties parseSpecialTag( std::string_view tag ) {
|
||||
if( !tag.empty() && tag[0] == '.' )
|
||||
return TestCaseProperties::IsHidden;
|
||||
else if( tag == "!throws"_sr )
|
||||
else if( tag == "!throws" )
|
||||
return TestCaseProperties::Throws;
|
||||
else if( tag == "!shouldfail"_sr )
|
||||
else if( tag == "!shouldfail" )
|
||||
return TestCaseProperties::ShouldFail;
|
||||
else if( tag == "!mayfail"_sr )
|
||||
else if( tag == "!mayfail" )
|
||||
return TestCaseProperties::MayFail;
|
||||
else if( tag == "!nonportable"_sr )
|
||||
else if( tag == "!nonportable" )
|
||||
return TestCaseProperties::NonPortable;
|
||||
else if( tag == "!benchmark"_sr )
|
||||
else if( tag == "!benchmark" )
|
||||
return TestCaseProperties::Benchmark | TestCaseProperties::IsHidden;
|
||||
else
|
||||
return TestCaseProperties::None;
|
||||
}
|
||||
bool isReservedTag( StringRef tag ) {
|
||||
bool isReservedTag( std::string_view tag ) {
|
||||
return parseSpecialTag( tag ) == TestCaseProperties::None
|
||||
&& tag.size() > 0
|
||||
&& !std::isalnum( static_cast<unsigned char>(tag[0]) );
|
||||
}
|
||||
void enforceNotReservedTag( StringRef tag, SourceLineInfo const& _lineInfo ) {
|
||||
void enforceNotReservedTag( std::string_view tag, SourceLineInfo const& _lineInfo ) {
|
||||
CATCH_ENFORCE( !isReservedTag(tag),
|
||||
"Tag name: [" << tag << "] is not allowed.\n"
|
||||
<< "Tag names starting with non alphanumeric characters are reserved\n"
|
||||
@@ -80,13 +81,13 @@ namespace Catch {
|
||||
return "Anonymous test case " + std::to_string(++counter);
|
||||
}
|
||||
|
||||
constexpr StringRef extractFilenamePart(StringRef filename) {
|
||||
constexpr std::string_view extractFilenamePart(std::string_view filename) {
|
||||
size_t lastDot = filename.size();
|
||||
while (lastDot > 0 && filename[lastDot - 1] != '.') {
|
||||
--lastDot;
|
||||
}
|
||||
// In theory we could have filename without any extension in it
|
||||
if ( lastDot == 0 ) { return StringRef(); }
|
||||
if ( lastDot == 0 ) { return std::string_view(); }
|
||||
|
||||
--lastDot;
|
||||
size_t nameStart = lastDot;
|
||||
@@ -98,7 +99,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
// Returns the upper bound on size of extra tags ([#file]+[.])
|
||||
constexpr size_t sizeOfExtraTags(StringRef filepath) {
|
||||
constexpr size_t sizeOfExtraTags(std::string_view filepath) {
|
||||
// [.] is 3, [#] is another 3
|
||||
const size_t extras = 3 + 3;
|
||||
return extractFilenamePart(filepath).size() + extras;
|
||||
@@ -115,20 +116,20 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Detail::unique_ptr<TestCaseInfo>
|
||||
makeTestCaseInfo(StringRef _className,
|
||||
makeTestCaseInfo(std::string_view _className,
|
||||
NameAndTags const& nameAndTags,
|
||||
SourceLineInfo const& _lineInfo ) {
|
||||
return Detail::make_unique<TestCaseInfo>(_className, nameAndTags, _lineInfo);
|
||||
}
|
||||
|
||||
TestCaseInfo::TestCaseInfo(StringRef _className,
|
||||
TestCaseInfo::TestCaseInfo(std::string_view _className,
|
||||
NameAndTags const& _nameAndTags,
|
||||
SourceLineInfo const& _lineInfo):
|
||||
name( _nameAndTags.name.empty() ? makeDefaultName() : _nameAndTags.name ),
|
||||
className( _className ),
|
||||
lineInfo( _lineInfo )
|
||||
{
|
||||
StringRef originalTags = _nameAndTags.tags;
|
||||
std::string_view originalTags = _nameAndTags.tags;
|
||||
// We need to reserve enough space to store all of the tags
|
||||
// (including optional hidden tag and filename tag)
|
||||
auto requiredSize = originalTags.size() + sizeOfExtraTags(_lineInfo.file);
|
||||
@@ -163,7 +164,7 @@ namespace Catch {
|
||||
// We need to check the tag for special meanings, copy
|
||||
// it over to backing storage and actually reference the
|
||||
// backing storage in the saved tags
|
||||
StringRef tagStr = originalTags.substr(tagStart+1, tagEnd - tagStart - 1);
|
||||
std::string_view tagStr = originalTags.substr(tagStart+1, tagEnd - tagStart - 1);
|
||||
CATCH_ENFORCE( !tagStr.empty(),
|
||||
"Found an empty tag while registering test case '"
|
||||
<< _nameAndTags.name << "' at "
|
||||
@@ -190,7 +191,7 @@ namespace Catch {
|
||||
|
||||
// Add [.] if relevant
|
||||
if (isHidden()) {
|
||||
internalAppendTag("."_sr);
|
||||
internalAppendTag(".");
|
||||
}
|
||||
|
||||
// Sort and prepare tags
|
||||
@@ -235,13 +236,13 @@ namespace Catch {
|
||||
return ret;
|
||||
}
|
||||
|
||||
void TestCaseInfo::internalAppendTag(StringRef tagStr) {
|
||||
void TestCaseInfo::internalAppendTag(std::string_view tagStr) {
|
||||
backingTags += '[';
|
||||
const auto backingStart = backingTags.size();
|
||||
backingTags += tagStr;
|
||||
const auto backingEnd = backingTags.size();
|
||||
backingTags += ']';
|
||||
tags.emplace_back(StringRef(backingTags.c_str() + backingStart, backingEnd - backingStart));
|
||||
tags.emplace_back(std::string_view(backingTags.c_str() + backingStart, backingEnd - backingStart));
|
||||
}
|
||||
|
||||
bool operator<( TestCaseInfo const& lhs, TestCaseInfo const& rhs ) {
|
||||
|
@@ -11,12 +11,12 @@
|
||||
#include <catch2/interfaces/catch_interfaces_test_invoker.hpp>
|
||||
#include <catch2/internal/catch_source_line_info.hpp>
|
||||
#include <catch2/internal/catch_noncopyable.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_unique_ptr.hpp>
|
||||
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#ifdef __clang__
|
||||
@@ -34,10 +34,10 @@ namespace Catch {
|
||||
* as "cool-tag" internally.
|
||||
*/
|
||||
struct Tag {
|
||||
constexpr Tag(StringRef original_):
|
||||
constexpr Tag(std::string_view original_):
|
||||
original(original_)
|
||||
{}
|
||||
StringRef original;
|
||||
std::string_view original;
|
||||
|
||||
friend bool operator< ( Tag const& lhs, Tag const& rhs );
|
||||
friend bool operator==( Tag const& lhs, Tag const& rhs );
|
||||
@@ -67,7 +67,7 @@ namespace Catch {
|
||||
*/
|
||||
struct TestCaseInfo : Detail::NonCopyable {
|
||||
|
||||
TestCaseInfo(StringRef _className,
|
||||
TestCaseInfo(std::string_view _className,
|
||||
NameAndTags const& _nameAndTags,
|
||||
SourceLineInfo const& _lineInfo);
|
||||
|
||||
@@ -87,12 +87,12 @@ namespace Catch {
|
||||
std::string tagsAsString() const;
|
||||
|
||||
std::string name;
|
||||
StringRef className;
|
||||
std::string_view className;
|
||||
private:
|
||||
std::string backingTags;
|
||||
// Internally we copy tags to the backing storage and then add
|
||||
// refs to this storage to the tags vector.
|
||||
void internalAppendTag(StringRef tagString);
|
||||
void internalAppendTag(std::string_view tagString);
|
||||
public:
|
||||
std::vector<Tag> tags;
|
||||
SourceLineInfo lineInfo;
|
||||
@@ -130,7 +130,7 @@ namespace Catch {
|
||||
};
|
||||
|
||||
Detail::unique_ptr<TestCaseInfo>
|
||||
makeTestCaseInfo( StringRef className,
|
||||
makeTestCaseInfo( std::string_view className,
|
||||
NameAndTags const& nameAndTags,
|
||||
SourceLineInfo const& lineInfo );
|
||||
}
|
||||
|
@@ -8,13 +8,13 @@
|
||||
#ifndef CATCH_TEST_RUN_INFO_HPP_INCLUDED
|
||||
#define CATCH_TEST_RUN_INFO_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <string_view>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct TestRunInfo {
|
||||
constexpr TestRunInfo(StringRef _name) : name(_name) {}
|
||||
StringRef name;
|
||||
constexpr TestRunInfo(std::string_view _name) : name(_name) {}
|
||||
std::string_view name;
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
@@ -58,7 +58,7 @@ namespace Detail {
|
||||
}
|
||||
} // end unnamed namespace
|
||||
|
||||
std::string convertIntoString(StringRef string, bool escapeInvisibles) {
|
||||
std::string convertIntoString(std::string_view string, bool escapeInvisibles) {
|
||||
std::string ret;
|
||||
// This is enough for the "don't escape invisibles" case, and a good
|
||||
// lower bound on the "escape invisibles" case.
|
||||
@@ -96,7 +96,7 @@ namespace Detail {
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::string convertIntoString(StringRef string) {
|
||||
std::string convertIntoString(std::string_view string) {
|
||||
return convertIntoString(string, getCurrentContext().getConfig()->showInvisibles());
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ std::string StringMaker<std::string>::convert(const std::string& str) {
|
||||
}
|
||||
|
||||
std::string StringMaker<std::string_view>::convert(std::string_view str) {
|
||||
return Detail::convertIntoString( StringRef( str.data(), str.size() ) );
|
||||
return Detail::convertIntoString( std::string_view( str.data(), str.size() ) );
|
||||
}
|
||||
|
||||
std::string StringMaker<char const*>::convert(char const* str) {
|
||||
|
@@ -46,14 +46,14 @@ namespace Catch {
|
||||
return n;
|
||||
}
|
||||
|
||||
constexpr StringRef unprintableString = "{?}"_sr;
|
||||
constexpr std::string_view unprintableString = "{?}";
|
||||
|
||||
//! Encases `string in quotes, and optionally escapes invisibles
|
||||
std::string convertIntoString( StringRef string, bool escapeInvisibles );
|
||||
std::string convertIntoString( std::string_view string, bool escapeInvisibles );
|
||||
|
||||
//! Encases `string` in quotes, and escapes invisibles if user requested
|
||||
//! it via CLI
|
||||
std::string convertIntoString( StringRef string );
|
||||
std::string convertIntoString( std::string_view string );
|
||||
|
||||
std::string rawMemoryToString( const void *object, std::size_t size );
|
||||
|
||||
@@ -210,7 +210,7 @@ namespace Catch {
|
||||
struct StringMaker<char[SZ]> {
|
||||
static std::string convert(char const* str) {
|
||||
return Detail::convertIntoString(
|
||||
StringRef( str, Detail::catch_strnlen( str, SZ ) ) );
|
||||
std::string_view( str, Detail::catch_strnlen( str, SZ ) ) );
|
||||
}
|
||||
};
|
||||
template<size_t SZ>
|
||||
@@ -218,7 +218,7 @@ namespace Catch {
|
||||
static std::string convert(signed char const* str) {
|
||||
auto reinterpreted = reinterpret_cast<char const*>(str);
|
||||
return Detail::convertIntoString(
|
||||
StringRef(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ)));
|
||||
std::string_view(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ)));
|
||||
}
|
||||
};
|
||||
template<size_t SZ>
|
||||
@@ -226,7 +226,7 @@ namespace Catch {
|
||||
static std::string convert(unsigned char const* str) {
|
||||
auto reinterpreted = reinterpret_cast<char const*>(str);
|
||||
return Detail::convertIntoString(
|
||||
StringRef(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ)));
|
||||
std::string_view(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ)));
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -27,11 +27,11 @@ namespace Detail {
|
||||
|
||||
GeneratorUntypedBase::~GeneratorUntypedBase() = default;
|
||||
|
||||
IGeneratorTracker* acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) {
|
||||
IGeneratorTracker* acquireGeneratorTracker(std::string_view generatorName, SourceLineInfo const& lineInfo ) {
|
||||
return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo );
|
||||
}
|
||||
|
||||
IGeneratorTracker* createGeneratorTracker( StringRef generatorName,
|
||||
IGeneratorTracker* createGeneratorTracker( std::string_view generatorName,
|
||||
SourceLineInfo lineInfo,
|
||||
GeneratorBasePtr&& generator ) {
|
||||
return getResultCapture().createGeneratorTracker(
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include <catch2/catch_tostring.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_generatortracker.hpp>
|
||||
#include <catch2/internal/catch_source_line_info.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||
#include <catch2/internal/catch_unique_name.hpp>
|
||||
|
||||
@@ -197,14 +196,14 @@ namespace Detail {
|
||||
return makeGenerators( value( T( CATCH_FORWARD( val ) ) ), CATCH_FORWARD( moreGenerators )... );
|
||||
}
|
||||
|
||||
IGeneratorTracker* acquireGeneratorTracker( StringRef generatorName,
|
||||
IGeneratorTracker* acquireGeneratorTracker( std::string_view generatorName,
|
||||
SourceLineInfo const& lineInfo );
|
||||
IGeneratorTracker* createGeneratorTracker( StringRef generatorName,
|
||||
IGeneratorTracker* createGeneratorTracker( std::string_view generatorName,
|
||||
SourceLineInfo lineInfo,
|
||||
GeneratorBasePtr&& generator );
|
||||
|
||||
template<typename L>
|
||||
auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> typename decltype(generatorExpression())::type {
|
||||
auto generate( std::string_view generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> typename decltype(generatorExpression())::type {
|
||||
using UnderlyingType = typename decltype(generatorExpression())::type;
|
||||
|
||||
IGeneratorTracker* tracker = acquireGeneratorTracker( generatorName, lineInfo );
|
||||
@@ -225,7 +224,7 @@ namespace Detail {
|
||||
} // namespace Generators
|
||||
} // namespace Catch
|
||||
|
||||
#define CATCH_INTERNAL_GENERATOR_STRINGIZE_IMPL( ... ) #__VA_ARGS__##_catch_sr
|
||||
#define CATCH_INTERNAL_GENERATOR_STRINGIZE_IMPL( ... ) #__VA_ARGS__
|
||||
#define CATCH_INTERNAL_GENERATOR_STRINGIZE(...) CATCH_INTERNAL_GENERATOR_STRINGIZE_IMPL(__VA_ARGS__)
|
||||
|
||||
#define GENERATE( ... ) \
|
||||
|
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_result_type.hpp>
|
||||
#include <catch2/internal/catch_unique_ptr.hpp>
|
||||
#include <catch2/benchmark/detail/catch_benchmark_stats_fwd.hpp>
|
||||
@@ -43,31 +42,31 @@ namespace Catch {
|
||||
virtual ~IResultCapture();
|
||||
|
||||
virtual void notifyAssertionStarted( AssertionInfo const& info ) = 0;
|
||||
virtual bool sectionStarted( StringRef sectionName,
|
||||
virtual bool sectionStarted( std::string_view sectionName,
|
||||
SourceLineInfo const& sectionLineInfo,
|
||||
Counts& assertions ) = 0;
|
||||
virtual void sectionEnded( SectionEndInfo&& endInfo ) = 0;
|
||||
virtual void sectionEndedEarly( SectionEndInfo&& endInfo ) = 0;
|
||||
|
||||
virtual IGeneratorTracker*
|
||||
acquireGeneratorTracker( StringRef generatorName,
|
||||
acquireGeneratorTracker( std::string_view generatorName,
|
||||
SourceLineInfo const& lineInfo ) = 0;
|
||||
virtual IGeneratorTracker*
|
||||
createGeneratorTracker( StringRef generatorName,
|
||||
createGeneratorTracker( std::string_view generatorName,
|
||||
SourceLineInfo lineInfo,
|
||||
Generators::GeneratorBasePtr&& generator ) = 0;
|
||||
|
||||
virtual void benchmarkPreparing( StringRef name ) = 0;
|
||||
virtual void benchmarkPreparing( std::string_view name ) = 0;
|
||||
virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0;
|
||||
virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0;
|
||||
virtual void benchmarkFailed( StringRef error ) = 0;
|
||||
virtual void benchmarkFailed( std::string_view error ) = 0;
|
||||
|
||||
virtual void pushScopedMessage( MessageInfo&& message ) = 0;
|
||||
virtual void popScopedMessage( unsigned int messageId ) = 0;
|
||||
|
||||
virtual void emplaceUnscopedMessage( MessageBuilder&& builder ) = 0;
|
||||
|
||||
virtual void handleFatalErrorCondition( StringRef message ) = 0;
|
||||
virtual void handleFatalErrorCondition( std::string_view message ) = 0;
|
||||
|
||||
virtual void handleExpr
|
||||
( AssertionInfo const& info,
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#define CATCH_INTERFACES_CONFIG_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_noncopyable.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
@@ -66,7 +65,7 @@ namespace Catch {
|
||||
virtual ~IConfig();
|
||||
|
||||
virtual bool allowThrows() const = 0;
|
||||
virtual StringRef name() const = 0;
|
||||
virtual std::string_view name() const = 0;
|
||||
virtual bool includeSuccessfulResults() const = 0;
|
||||
virtual bool shouldDebugBreak() const = 0;
|
||||
virtual bool warnAboutMissingAssertions() const = 0;
|
||||
|
@@ -8,20 +8,19 @@
|
||||
#ifndef CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED
|
||||
#define CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
namespace Detail {
|
||||
struct EnumInfo {
|
||||
StringRef m_name;
|
||||
std::vector<std::pair<int, StringRef>> m_values;
|
||||
std::string_view m_name;
|
||||
std::vector<std::pair<int, std::string_view>> m_values;
|
||||
|
||||
~EnumInfo();
|
||||
|
||||
StringRef lookup( int value ) const;
|
||||
std::string_view lookup( int value ) const;
|
||||
};
|
||||
} // namespace Detail
|
||||
|
||||
@@ -29,10 +28,10 @@ namespace Catch {
|
||||
public:
|
||||
virtual ~IMutableEnumValuesRegistry(); // = default;
|
||||
|
||||
virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values ) = 0;
|
||||
virtual Detail::EnumInfo const& registerEnum( std::string_view enumName, std::string_view allEnums, std::vector<int> const& values ) = 0;
|
||||
|
||||
template<typename E>
|
||||
Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list<E> values ) {
|
||||
Detail::EnumInfo const& registerEnum( std::string_view enumName, std::string_view allEnums, std::initializer_list<E> values ) {
|
||||
static_assert(sizeof(int) >= sizeof(E), "Cannot serialize enum to int");
|
||||
std::vector<int> intValues;
|
||||
intValues.reserve( values.size() );
|
||||
|
@@ -21,7 +21,7 @@ namespace Catch {
|
||||
return ret;
|
||||
}
|
||||
|
||||
StringRef GeneratorUntypedBase::currentElementAsString() const {
|
||||
std::string_view GeneratorUntypedBase::currentElementAsString() const {
|
||||
if ( m_stringReprCache.empty() ) {
|
||||
m_stringReprCache = stringifyImpl();
|
||||
}
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#define CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_unique_ptr.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -71,7 +70,7 @@ namespace Catch {
|
||||
* is destructed, or it moves onto the next element, whichever
|
||||
* comes first.
|
||||
*/
|
||||
StringRef currentElementAsString() const;
|
||||
std::string_view currentElementAsString() const;
|
||||
};
|
||||
using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>;
|
||||
|
||||
|
@@ -13,7 +13,6 @@
|
||||
#include <catch2/catch_totals.hpp>
|
||||
#include <catch2/catch_assertion_result.hpp>
|
||||
#include <catch2/internal/catch_message_info.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_unique_ptr.hpp>
|
||||
#include <catch2/benchmark/detail/catch_benchmark_stats.hpp>
|
||||
|
||||
@@ -154,9 +153,9 @@ namespace Catch {
|
||||
}
|
||||
|
||||
//! Called when no test cases match provided test spec
|
||||
virtual void noMatchingTestCases( StringRef unmatchedSpec ) = 0;
|
||||
virtual void noMatchingTestCases( std::string_view unmatchedSpec ) = 0;
|
||||
//! Called for all invalid test specs from the cli
|
||||
virtual void reportInvalidTestSpec( StringRef invalidArgument ) = 0;
|
||||
virtual void reportInvalidTestSpec( std::string_view invalidArgument ) = 0;
|
||||
|
||||
/**
|
||||
* Called once in a testing run before tests are started
|
||||
@@ -173,13 +172,13 @@ namespace Catch {
|
||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;
|
||||
|
||||
//! Called when user-code is being probed before the actual benchmark runs
|
||||
virtual void benchmarkPreparing( StringRef benchmarkName ) = 0;
|
||||
virtual void benchmarkPreparing( std::string_view benchmarkName ) = 0;
|
||||
//! Called after probe but before the user-code is being benchmarked
|
||||
virtual void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) = 0;
|
||||
//! Called with the benchmark results if benchmark successfully finishes
|
||||
virtual void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) = 0;
|
||||
//! Called if running the benchmarks fails for any reason
|
||||
virtual void benchmarkFailed( StringRef benchmarkName ) = 0;
|
||||
virtual void benchmarkFailed( std::string_view benchmarkName ) = 0;
|
||||
|
||||
//! Called before assertion success/failure is evaluated
|
||||
virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;
|
||||
@@ -209,7 +208,7 @@ namespace Catch {
|
||||
virtual void skipTest( TestCaseInfo const& testInfo ) = 0;
|
||||
|
||||
//! Called if a fatal error (signal/structured exception) occurred
|
||||
virtual void fatalErrorEncountered( StringRef error ) = 0;
|
||||
virtual void fatalErrorEncountered( std::string_view error ) = 0;
|
||||
|
||||
//! Writes out information about provided reporters using reporter-specific format
|
||||
virtual void listReporters(std::vector<ReporterDescription> const& descriptions) = 0;
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#define CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_unique_ptr.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -36,7 +35,7 @@ namespace Catch {
|
||||
virtual ~EventListenerFactory(); // = default
|
||||
virtual IEventListenerPtr create( IConfig const* config ) const = 0;
|
||||
//! Return a meaningful name for the listener, e.g. its type name
|
||||
virtual StringRef getName() const = 0;
|
||||
virtual std::string_view getName() const = 0;
|
||||
//! Return listener's description if available
|
||||
virtual std::string getDescription() const = 0;
|
||||
};
|
||||
|
@@ -15,9 +15,9 @@
|
||||
namespace Catch {
|
||||
|
||||
AssertionHandler::AssertionHandler
|
||||
( StringRef macroName,
|
||||
( std::string_view macroName,
|
||||
SourceLineInfo const& lineInfo,
|
||||
StringRef capturedExpression,
|
||||
std::string_view capturedExpression,
|
||||
ResultDisposition::Flags resultDisposition )
|
||||
: m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },
|
||||
m_resultCapture( getResultCapture() )
|
||||
|
@@ -30,9 +30,9 @@ namespace Catch {
|
||||
|
||||
public:
|
||||
AssertionHandler
|
||||
( StringRef macroName,
|
||||
( std::string_view macroName,
|
||||
SourceLineInfo const& lineInfo,
|
||||
StringRef capturedExpression,
|
||||
std::string_view capturedExpression,
|
||||
ResultDisposition::Flags resultDisposition );
|
||||
~AssertionHandler() {
|
||||
if ( !m_completed ) {
|
||||
|
@@ -14,8 +14,8 @@
|
||||
namespace Catch {
|
||||
namespace Detail {
|
||||
|
||||
bool CaseInsensitiveLess::operator()( StringRef lhs,
|
||||
StringRef rhs ) const {
|
||||
bool CaseInsensitiveLess::operator()( std::string_view lhs,
|
||||
std::string_view rhs ) const {
|
||||
return std::lexicographical_compare(
|
||||
lhs.begin(), lhs.end(),
|
||||
rhs.begin(), rhs.end(),
|
||||
@@ -23,8 +23,8 @@ namespace Catch {
|
||||
}
|
||||
|
||||
bool
|
||||
CaseInsensitiveEqualTo::operator()( StringRef lhs,
|
||||
StringRef rhs ) const {
|
||||
CaseInsensitiveEqualTo::operator()( std::string_view lhs,
|
||||
std::string_view rhs ) const {
|
||||
return std::equal(
|
||||
lhs.begin(), lhs.end(),
|
||||
rhs.begin(), rhs.end(),
|
||||
|
@@ -8,20 +8,20 @@
|
||||
#ifndef CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED
|
||||
#define CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <string_view>
|
||||
|
||||
namespace Catch {
|
||||
namespace Detail {
|
||||
//! Provides case-insensitive `op<` semantics when called
|
||||
struct CaseInsensitiveLess {
|
||||
bool operator()( StringRef lhs,
|
||||
StringRef rhs ) const;
|
||||
bool operator()( std::string_view lhs,
|
||||
std::string_view rhs ) const;
|
||||
};
|
||||
|
||||
//! Provides case-insensitive `op==` semantics when called
|
||||
struct CaseInsensitiveEqualTo {
|
||||
bool operator()( StringRef lhs,
|
||||
StringRef rhs ) const;
|
||||
bool operator()( std::string_view lhs,
|
||||
std::string_view rhs ) const;
|
||||
};
|
||||
|
||||
} // namespace Detail
|
||||
|
@@ -25,7 +25,7 @@ namespace {
|
||||
;
|
||||
}
|
||||
|
||||
Catch::StringRef normaliseOpt( Catch::StringRef optName ) {
|
||||
std::string_view normaliseOpt( std::string_view optName ) {
|
||||
if ( optName[0] == '-'
|
||||
#if defined(CATCH_PLATFORM_WINDOWS)
|
||||
|| optName[0] == '/'
|
||||
@@ -37,7 +37,7 @@ namespace {
|
||||
return optName;
|
||||
}
|
||||
|
||||
static size_t find_first_separator(Catch::StringRef sr) {
|
||||
static size_t find_first_separator(std::string_view sr) {
|
||||
auto is_separator = []( char c ) {
|
||||
return c == ' ' || c == ':' || c == '=';
|
||||
};
|
||||
@@ -47,7 +47,7 @@ namespace {
|
||||
++pos;
|
||||
}
|
||||
|
||||
return Catch::StringRef::npos;
|
||||
return std::string_view::npos;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -65,10 +65,10 @@ namespace Catch {
|
||||
}
|
||||
|
||||
if ( it != itEnd ) {
|
||||
StringRef next = *it;
|
||||
std::string_view next = *it;
|
||||
if ( isOptPrefix( next[0] ) ) {
|
||||
auto delimiterPos = find_first_separator(next);
|
||||
if ( delimiterPos != StringRef::npos ) {
|
||||
if ( delimiterPos != std::string_view::npos ) {
|
||||
m_tokenBuffer.push_back(
|
||||
{ TokenType::Option,
|
||||
next.substr( 0, delimiterPos ) } );
|
||||
@@ -205,7 +205,7 @@ namespace Catch {
|
||||
return { oss.str(), m_description };
|
||||
}
|
||||
|
||||
bool Opt::isMatch(StringRef optToken) const {
|
||||
bool Opt::isMatch(std::string_view optToken) const {
|
||||
auto normalisedToken = normaliseOpt(optToken);
|
||||
for (auto const& name : m_optNames) {
|
||||
if (normaliseOpt(name) == normalisedToken)
|
||||
@@ -243,12 +243,12 @@ namespace Catch {
|
||||
if (!tokens)
|
||||
return Detail::InternalParseResult::runtimeError(
|
||||
"Expected argument following " +
|
||||
token.token);
|
||||
std::string(token.token));
|
||||
auto const& argToken = *tokens;
|
||||
if (argToken.type != Detail::TokenType::Argument)
|
||||
return Detail::InternalParseResult::runtimeError(
|
||||
"Expected argument following " +
|
||||
token.token);
|
||||
std::string(token.token));
|
||||
const auto result = valueRef->setValue(static_cast<std::string>(argToken.token));
|
||||
if (!result)
|
||||
return Detail::InternalParseResult(result);
|
||||
@@ -436,7 +436,7 @@ namespace Catch {
|
||||
if ( !tokenParsed )
|
||||
return Detail::InternalParseResult::runtimeError(
|
||||
"Unrecognised token: " +
|
||||
result.value().remainingTokens()->token );
|
||||
std::string(result.value().remainingTokens()->token) );
|
||||
}
|
||||
// !TBD Check missing required options
|
||||
return result;
|
||||
@@ -445,7 +445,7 @@ namespace Catch {
|
||||
Args::Args(int argc, char const* const* argv) :
|
||||
m_exeName(argv[0]), m_args(argv + 1, argv + argc) {}
|
||||
|
||||
Args::Args(std::initializer_list<StringRef> args) :
|
||||
Args::Args(std::initializer_list<std::string_view> args) :
|
||||
m_exeName(*args.begin()),
|
||||
m_args(args.begin() + 1, args.end()) {}
|
||||
|
||||
|
@@ -22,7 +22,6 @@
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||
#include <catch2/internal/catch_noncopyable.hpp>
|
||||
#include <catch2/internal/catch_void_type.hpp>
|
||||
@@ -93,13 +92,13 @@ namespace Catch {
|
||||
enum class TokenType { Option, Argument };
|
||||
struct Token {
|
||||
TokenType type;
|
||||
StringRef token;
|
||||
std::string_view token;
|
||||
};
|
||||
|
||||
// Abstracts iterators into args as a stream of tokens, with option
|
||||
// arguments uniformly handled
|
||||
class TokenStream {
|
||||
using Iterator = std::vector<StringRef>::const_iterator;
|
||||
using Iterator = std::vector<std::string_view>::const_iterator;
|
||||
Iterator it;
|
||||
Iterator itEnd;
|
||||
std::vector<Token> m_tokenBuffer;
|
||||
@@ -302,7 +301,7 @@ namespace Catch {
|
||||
|
||||
struct HelpColumns {
|
||||
std::string left;
|
||||
StringRef descriptions;
|
||||
std::string_view descriptions;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
@@ -480,8 +479,8 @@ namespace Catch {
|
||||
protected:
|
||||
Optionality m_optionality = Optionality::Optional;
|
||||
std::shared_ptr<BoundRef> m_ref;
|
||||
StringRef m_hint;
|
||||
StringRef m_description;
|
||||
std::string_view m_hint;
|
||||
std::string_view m_description;
|
||||
|
||||
explicit ParserRefImpl( std::shared_ptr<BoundRef> const& ref ):
|
||||
m_ref( ref ) {}
|
||||
@@ -490,29 +489,29 @@ namespace Catch {
|
||||
template <typename LambdaT>
|
||||
ParserRefImpl( accept_many_t,
|
||||
LambdaT const& ref,
|
||||
StringRef hint ):
|
||||
std::string_view hint ):
|
||||
m_ref( std::make_shared<BoundManyLambda<LambdaT>>( ref ) ),
|
||||
m_hint( hint ) {}
|
||||
|
||||
template <typename T,
|
||||
typename = typename std::enable_if_t<
|
||||
!Detail::is_unary_function_v<T>>>
|
||||
ParserRefImpl( T& ref, StringRef hint ):
|
||||
ParserRefImpl( T& ref, std::string_view hint ):
|
||||
m_ref( std::make_shared<BoundValueRef<T>>( ref ) ),
|
||||
m_hint( hint ) {}
|
||||
|
||||
template <typename LambdaT,
|
||||
typename = typename std::enable_if_t<
|
||||
Detail::is_unary_function_v<LambdaT>>>
|
||||
ParserRefImpl( LambdaT const& ref, StringRef hint ):
|
||||
ParserRefImpl( LambdaT const& ref, std::string_view hint ):
|
||||
m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),
|
||||
m_hint( hint ) {}
|
||||
|
||||
DerivedT& operator()( StringRef description ) & {
|
||||
DerivedT& operator()( std::string_view description ) & {
|
||||
m_description = description;
|
||||
return static_cast<DerivedT&>( *this );
|
||||
}
|
||||
DerivedT&& operator()( StringRef description ) && {
|
||||
DerivedT&& operator()( std::string_view description ) && {
|
||||
m_description = description;
|
||||
return static_cast<DerivedT&&>( *this );
|
||||
}
|
||||
@@ -538,7 +537,7 @@ namespace Catch {
|
||||
return 1;
|
||||
}
|
||||
|
||||
StringRef hint() const { return m_hint; }
|
||||
std::string_view hint() const { return m_hint; }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
@@ -558,7 +557,7 @@ namespace Catch {
|
||||
// A parser for options
|
||||
class Opt : public Detail::ParserRefImpl<Opt> {
|
||||
protected:
|
||||
std::vector<StringRef> m_optNames;
|
||||
std::vector<std::string_view> m_optNames;
|
||||
|
||||
public:
|
||||
template <typename LambdaT>
|
||||
@@ -571,31 +570,31 @@ namespace Catch {
|
||||
template <typename LambdaT,
|
||||
typename = typename std::enable_if_t<
|
||||
Detail::is_unary_function_v<LambdaT>>>
|
||||
Opt( LambdaT const& ref, StringRef hint ):
|
||||
Opt( LambdaT const& ref, std::string_view hint ):
|
||||
ParserRefImpl( ref, hint ) {}
|
||||
|
||||
template <typename LambdaT>
|
||||
Opt( accept_many_t, LambdaT const& ref, StringRef hint ):
|
||||
Opt( accept_many_t, LambdaT const& ref, std::string_view hint ):
|
||||
ParserRefImpl( accept_many, ref, hint ) {}
|
||||
|
||||
template <typename T,
|
||||
typename = typename std::enable_if_t<
|
||||
!Detail::is_unary_function_v<T>>>
|
||||
Opt( T& ref, StringRef hint ):
|
||||
Opt( T& ref, std::string_view hint ):
|
||||
ParserRefImpl( ref, hint ) {}
|
||||
|
||||
Opt& operator[]( StringRef optName ) & {
|
||||
Opt& operator[]( std::string_view optName ) & {
|
||||
m_optNames.push_back(optName);
|
||||
return *this;
|
||||
}
|
||||
Opt&& operator[]( StringRef optName ) && {
|
||||
Opt&& operator[]( std::string_view optName ) && {
|
||||
m_optNames.push_back( optName );
|
||||
return CATCH_MOVE(*this);
|
||||
}
|
||||
|
||||
Detail::HelpColumns getHelpColumns() const;
|
||||
|
||||
bool isMatch(StringRef optToken) const;
|
||||
bool isMatch(std::string_view optToken) const;
|
||||
|
||||
using ParserBase::parse;
|
||||
|
||||
@@ -696,15 +695,15 @@ namespace Catch {
|
||||
*/
|
||||
class Args {
|
||||
friend Detail::TokenStream;
|
||||
StringRef m_exeName;
|
||||
std::vector<StringRef> m_args;
|
||||
std::string_view m_exeName;
|
||||
std::vector<std::string_view> m_args;
|
||||
|
||||
public:
|
||||
Args(int argc, char const* const* argv);
|
||||
// Helper constructor for testing
|
||||
Args(std::initializer_list<StringRef> args);
|
||||
Args(std::initializer_list<std::string_view> args);
|
||||
|
||||
StringRef exeName() const { return m_exeName; }
|
||||
std::string_view exeName() const { return m_exeName; }
|
||||
};
|
||||
|
||||
|
||||
|
@@ -17,7 +17,7 @@ namespace Catch {
|
||||
os << "Some class derived from ITransientExpression without overriding streamReconstructedExpression";
|
||||
}
|
||||
|
||||
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {
|
||||
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, std::string_view op, std::string const& rhs ) {
|
||||
if( lhs.size() + rhs.size() < 40 &&
|
||||
lhs.find('\n') == std::string::npos &&
|
||||
rhs.find('\n') == std::string::npos )
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#define CATCH_DECOMPOSER_HPP_INCLUDED
|
||||
|
||||
#include <catch2/catch_tostring.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_compare_traits.hpp>
|
||||
#include <catch2/internal/catch_test_failure_exception.hpp>
|
||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||
@@ -189,12 +188,12 @@ namespace Catch {
|
||||
}
|
||||
};
|
||||
|
||||
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );
|
||||
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, std::string_view op, std::string const& rhs );
|
||||
|
||||
template<typename LhsT, typename RhsT>
|
||||
class BinaryExpr : public ITransientExpression {
|
||||
LhsT m_lhs;
|
||||
StringRef m_op;
|
||||
std::string_view m_op;
|
||||
RhsT m_rhs;
|
||||
|
||||
void streamReconstructedExpression( std::ostream &os ) const override {
|
||||
@@ -203,7 +202,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
public:
|
||||
constexpr BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs )
|
||||
constexpr BinaryExpr( bool comparisonResult, LhsT lhs, std::string_view op, RhsT rhs )
|
||||
: ITransientExpression{ true, comparisonResult },
|
||||
m_lhs( lhs ),
|
||||
m_op( op ),
|
||||
@@ -298,7 +297,7 @@ namespace Catch {
|
||||
Detail::RemoveCVRef_t<RhsT>>>>, \
|
||||
BinaryExpr<LhsT, RhsT const&>> { \
|
||||
return { \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
|
||||
} \
|
||||
template <typename RhsT> \
|
||||
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
|
||||
@@ -307,7 +306,7 @@ namespace Catch {
|
||||
capture_by_value<RhsT>>, \
|
||||
BinaryExpr<LhsT, RhsT>> { \
|
||||
return { \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
|
||||
} \
|
||||
template <typename RhsT> \
|
||||
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
|
||||
@@ -321,7 +320,7 @@ namespace Catch {
|
||||
BinaryExpr<LhsT, RhsT>> { \
|
||||
if ( rhs != 0 ) { throw_test_failure_exception(); } \
|
||||
return { \
|
||||
static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs }; \
|
||||
static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op, rhs }; \
|
||||
} \
|
||||
template <typename RhsT> \
|
||||
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
|
||||
@@ -334,7 +333,7 @@ namespace Catch {
|
||||
std::is_same<LhsT, long>>>, \
|
||||
BinaryExpr<LhsT, RhsT>> { \
|
||||
if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); } \
|
||||
return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
|
||||
return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op, rhs }; \
|
||||
}
|
||||
|
||||
CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( eq, == )
|
||||
@@ -352,7 +351,7 @@ namespace Catch {
|
||||
Detail::RemoveCVRef_t<RhsT>>>>, \
|
||||
BinaryExpr<LhsT, RhsT const&>> { \
|
||||
return { \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
|
||||
} \
|
||||
template <typename RhsT> \
|
||||
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
|
||||
@@ -361,7 +360,7 @@ namespace Catch {
|
||||
capture_by_value<RhsT>> , \
|
||||
BinaryExpr<LhsT, RhsT>> { \
|
||||
return { \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
|
||||
} \
|
||||
template <typename RhsT> \
|
||||
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
|
||||
@@ -373,7 +372,7 @@ namespace Catch {
|
||||
BinaryExpr<LhsT, RhsT>> { \
|
||||
if ( rhs != 0 ) { throw_test_failure_exception(); } \
|
||||
return { \
|
||||
static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs }; \
|
||||
static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op, rhs }; \
|
||||
} \
|
||||
template <typename RhsT> \
|
||||
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
|
||||
@@ -384,7 +383,7 @@ namespace Catch {
|
||||
std::is_same<LhsT, int>>, \
|
||||
BinaryExpr<LhsT, RhsT>> { \
|
||||
if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); } \
|
||||
return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
|
||||
return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op, rhs }; \
|
||||
}
|
||||
|
||||
CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( lt, < )
|
||||
@@ -402,14 +401,14 @@ namespace Catch {
|
||||
!capture_by_value<Detail::RemoveCVRef_t<RhsT>>::value, \
|
||||
BinaryExpr<LhsT, RhsT const&>> { \
|
||||
return { \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
|
||||
} \
|
||||
template <typename RhsT> \
|
||||
constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs ) \
|
||||
-> std::enable_if_t<capture_by_value<RhsT>::value, \
|
||||
BinaryExpr<LhsT, RhsT>> { \
|
||||
return { \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
|
||||
static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op, rhs }; \
|
||||
}
|
||||
|
||||
CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(|)
|
||||
|
@@ -19,7 +19,7 @@ namespace Catch {
|
||||
namespace {
|
||||
// Extracts the actual name part of an enum instance
|
||||
// In other words, it returns the Blue part of Bikeshed::Colour::Blue
|
||||
StringRef extractInstanceName(StringRef enumInstance) {
|
||||
std::string_view extractInstanceName(std::string_view enumInstance) {
|
||||
// Find last occurrence of ":"
|
||||
size_t name_start = enumInstance.size();
|
||||
while (name_start > 0 && enumInstance[name_start - 1] != ':') {
|
||||
@@ -29,9 +29,9 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<StringRef> parseEnums( StringRef enums ) {
|
||||
std::vector<std::string_view> parseEnums( std::string_view enums ) {
|
||||
auto enumValues = splitStringRef( enums, ',' );
|
||||
std::vector<StringRef> parsed;
|
||||
std::vector<std::string_view> parsed;
|
||||
parsed.reserve( enumValues.size() );
|
||||
for( auto const& enumValue : enumValues ) {
|
||||
parsed.push_back(trim(extractInstanceName(enumValue)));
|
||||
@@ -41,15 +41,15 @@ namespace Catch {
|
||||
|
||||
EnumInfo::~EnumInfo() = default;
|
||||
|
||||
StringRef EnumInfo::lookup( int value ) const {
|
||||
std::string_view EnumInfo::lookup( int value ) const {
|
||||
for( auto const& valueToName : m_values ) {
|
||||
if( valueToName.first == value )
|
||||
return valueToName.second;
|
||||
}
|
||||
return "{** unexpected enum value **}"_sr;
|
||||
return "{** unexpected enum value **}";
|
||||
}
|
||||
|
||||
Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {
|
||||
Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( std::string_view enumName, std::string_view allValueNames, std::vector<int> const& values ) {
|
||||
auto enumInfo = Catch::Detail::make_unique<EnumInfo>();
|
||||
enumInfo->m_name = enumName;
|
||||
enumInfo->m_values.reserve( values.size() );
|
||||
@@ -63,11 +63,10 @@ namespace Catch {
|
||||
return enumInfo;
|
||||
}
|
||||
|
||||
EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {
|
||||
EnumInfo const& EnumValuesRegistry::registerEnum( std::string_view enumName, std::string_view allValueNames, std::vector<int> const& values ) {
|
||||
m_enumInfos.push_back(makeEnumInfo(enumName, allValueNames, values));
|
||||
return *m_enumInfos.back();
|
||||
}
|
||||
|
||||
} // Detail
|
||||
} // Catch
|
||||
|
||||
|
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <catch2/interfaces/catch_interfaces_enum_values_registry.hpp>
|
||||
#include <catch2/internal/catch_unique_ptr.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -18,16 +17,16 @@ namespace Catch {
|
||||
|
||||
namespace Detail {
|
||||
|
||||
Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values );
|
||||
Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( std::string_view enumName, std::string_view allValueNames, std::vector<int> const& values );
|
||||
|
||||
class EnumValuesRegistry : public IMutableEnumValuesRegistry {
|
||||
|
||||
std::vector<Catch::Detail::unique_ptr<EnumInfo>> m_enumInfos;
|
||||
|
||||
EnumInfo const& registerEnum( StringRef enumName, StringRef allValueNames, std::vector<int> const& values) override;
|
||||
EnumInfo const& registerEnum( std::string_view enumName, std::string_view allValueNames, std::vector<int> const& values) override;
|
||||
};
|
||||
|
||||
std::vector<StringRef> parseEnums( StringRef enums );
|
||||
std::vector<std::string_view> parseEnums( std::string_view enums );
|
||||
|
||||
} // Detail
|
||||
|
||||
|
@@ -17,21 +17,21 @@ namespace Catch {
|
||||
c == '\n' || c == '\r' || c == '\t';
|
||||
}
|
||||
|
||||
static Catch::StringRef makeEscapeStringRef( char c ) {
|
||||
static std::string_view makeEscapeStringRef( char c ) {
|
||||
if ( c == '"' ) {
|
||||
return "\\\""_sr;
|
||||
return "\\\"";
|
||||
} else if ( c == '\\' ) {
|
||||
return "\\\\"_sr;
|
||||
return "\\\\";
|
||||
} else if ( c == '\b' ) {
|
||||
return "\\b"_sr;
|
||||
return "\\b";
|
||||
} else if ( c == '\f' ) {
|
||||
return "\\f"_sr;
|
||||
return "\\f";
|
||||
} else if ( c == '\n' ) {
|
||||
return "\\n"_sr;
|
||||
return "\\n";
|
||||
} else if ( c == '\r' ) {
|
||||
return "\\r"_sr;
|
||||
return "\\r";
|
||||
} else if ( c == '\t' ) {
|
||||
return "\\t"_sr;
|
||||
return "\\t";
|
||||
}
|
||||
Catch::Detail::Unreachable();
|
||||
}
|
||||
@@ -75,7 +75,7 @@ namespace Catch {
|
||||
m_os << '}';
|
||||
}
|
||||
|
||||
JsonValueWriter JsonObjectWriter::write( StringRef key ) {
|
||||
JsonValueWriter JsonObjectWriter::write( std::string_view key ) {
|
||||
JsonUtils::appendCommaNewline(
|
||||
m_os, m_should_comma, m_indent_level + 1 );
|
||||
|
||||
@@ -136,15 +136,15 @@ namespace Catch {
|
||||
return JsonArrayWriter{ m_os, m_indent_level };
|
||||
}
|
||||
|
||||
void JsonValueWriter::write( Catch::StringRef value ) && {
|
||||
void JsonValueWriter::write( std::string_view value ) && {
|
||||
writeImpl( value, true );
|
||||
}
|
||||
|
||||
void JsonValueWriter::write( bool value ) && {
|
||||
writeImpl( value ? "true"_sr : "false"_sr, false );
|
||||
writeImpl( value ? "true" : "false", false );
|
||||
}
|
||||
|
||||
void JsonValueWriter::writeImpl( Catch::StringRef value, bool quote ) {
|
||||
void JsonValueWriter::writeImpl( std::string_view value, bool quote ) {
|
||||
if ( quote ) { m_os << '"'; }
|
||||
size_t current_start = 0;
|
||||
for ( size_t i = 0; i < value.size(); ++i ) {
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#define CATCH_JSONWRITER_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_reusable_string_stream.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <sstream>
|
||||
@@ -37,11 +36,11 @@ namespace Catch {
|
||||
void write( T const& value ) && {
|
||||
writeImpl( value, !std::is_arithmetic_v<T> );
|
||||
}
|
||||
void write( StringRef value ) &&;
|
||||
void write( std::string_view value ) &&;
|
||||
void write( bool value ) &&;
|
||||
|
||||
private:
|
||||
void writeImpl( StringRef value, bool quote );
|
||||
void writeImpl( std::string_view value, bool quote );
|
||||
|
||||
// Without this SFINAE, this overload is a better match
|
||||
// for `std::string`, `char const*`, `char const[N]` args.
|
||||
@@ -49,7 +48,7 @@ namespace Catch {
|
||||
// and multiple iteration over the strings
|
||||
template <typename T,
|
||||
typename = typename std::enable_if_t<
|
||||
!std::is_convertible_v<T, StringRef>>>
|
||||
!std::is_convertible_v<T, std::string_view>>>
|
||||
void writeImpl( T const& value, bool quote_value ) {
|
||||
m_sstream << value;
|
||||
writeImpl( m_sstream.str(), quote_value );
|
||||
@@ -70,7 +69,7 @@ namespace Catch {
|
||||
|
||||
~JsonObjectWriter();
|
||||
|
||||
JsonValueWriter write( StringRef key );
|
||||
JsonValueWriter write( std::string_view key );
|
||||
|
||||
private:
|
||||
std::ostream& m_os;
|
||||
|
@@ -30,7 +30,7 @@ namespace Catch {
|
||||
auto const& testSpec = config.testSpec();
|
||||
std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
|
||||
|
||||
std::map<StringRef, TagInfo, Detail::CaseInsensitiveLess> tagCounts;
|
||||
std::map<std::string_view, TagInfo, Detail::CaseInsensitiveLess> tagCounts;
|
||||
for (auto const& testCase : matchedTestCases) {
|
||||
for (auto const& tagName : testCase.getTestCaseInfo().tags) {
|
||||
auto it = tagCounts.find(tagName.original);
|
||||
@@ -75,7 +75,7 @@ namespace Catch {
|
||||
|
||||
} // end anonymous namespace
|
||||
|
||||
void TagInfo::add( StringRef spelling ) {
|
||||
void TagInfo::add( std::string_view spelling ) {
|
||||
++count;
|
||||
spellings.insert( spelling );
|
||||
}
|
||||
|
@@ -8,10 +8,9 @@
|
||||
#ifndef CATCH_LIST_HPP_INCLUDED
|
||||
#define CATCH_LIST_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
|
||||
namespace Catch {
|
||||
@@ -24,15 +23,15 @@ namespace Catch {
|
||||
std::string name, description;
|
||||
};
|
||||
struct ListenerDescription {
|
||||
StringRef name;
|
||||
std::string_view name;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
struct TagInfo {
|
||||
void add(StringRef spelling);
|
||||
void add(std::string_view spelling);
|
||||
std::string all() const;
|
||||
|
||||
std::set<StringRef> spellings;
|
||||
std::set<std::string_view> spellings;
|
||||
std::size_t count = 0;
|
||||
};
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
MessageInfo::MessageInfo( StringRef _macroName,
|
||||
MessageInfo::MessageInfo( std::string_view _macroName,
|
||||
SourceLineInfo const& _lineInfo,
|
||||
ResultWas::OfType _type )
|
||||
: macroName( _macroName ),
|
||||
|
@@ -11,18 +11,17 @@
|
||||
#include <catch2/internal/catch_deprecation_macro.hpp>
|
||||
#include <catch2/internal/catch_result_type.hpp>
|
||||
#include <catch2/internal/catch_source_line_info.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
struct MessageInfo {
|
||||
MessageInfo( StringRef _macroName,
|
||||
MessageInfo( std::string_view _macroName,
|
||||
SourceLineInfo const& _lineInfo,
|
||||
ResultWas::OfType _type );
|
||||
|
||||
StringRef macroName;
|
||||
std::string_view macroName;
|
||||
std::string message;
|
||||
SourceLineInfo lineInfo;
|
||||
ResultWas::OfType type;
|
||||
|
@@ -176,7 +176,7 @@ namespace Catch {
|
||||
template<typename... Ts>\
|
||||
void reg_test(TypeList<Ts...>, Catch::NameAndTags nameAndTags)\
|
||||
{\
|
||||
Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<Ts...>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\
|
||||
Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<Ts...>), CATCH_INTERNAL_LINEINFO, std::string_view(), nameAndTags);\
|
||||
}
|
||||
|
||||
#define INTERNAL_CATCH_NTTP_REGISTER0(TestFunc, signature, ...)
|
||||
@@ -184,19 +184,19 @@ namespace Catch {
|
||||
template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
|
||||
void reg_test(Nttp<__VA_ARGS__>, Catch::NameAndTags nameAndTags)\
|
||||
{\
|
||||
Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<__VA_ARGS__>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\
|
||||
Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<__VA_ARGS__>), CATCH_INTERNAL_LINEINFO, std::string_view(), nameAndTags);\
|
||||
}
|
||||
|
||||
#define INTERNAL_CATCH_NTTP_REGISTER_METHOD0(TestName, signature, ...)\
|
||||
template<typename Type>\
|
||||
void reg_test(TypeList<Type>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\
|
||||
void reg_test(TypeList<Type>, std::string_view className, Catch::NameAndTags nameAndTags)\
|
||||
{\
|
||||
Catch::AutoReg( Catch::makeTestInvoker(&TestName<Type>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\
|
||||
}
|
||||
|
||||
#define INTERNAL_CATCH_NTTP_REGISTER_METHOD(TestName, signature, ...)\
|
||||
template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\
|
||||
void reg_test(Nttp<__VA_ARGS__>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\
|
||||
void reg_test(Nttp<__VA_ARGS__>, std::string_view className, Catch::NameAndTags nameAndTags)\
|
||||
{\
|
||||
Catch::AutoReg( Catch::makeTestInvoker(&TestName<__VA_ARGS__>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\
|
||||
}
|
||||
|
@@ -11,9 +11,9 @@
|
||||
#include <catch2/catch_user_config.hpp>
|
||||
|
||||
#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)
|
||||
#define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__##_catch_sr
|
||||
#define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__
|
||||
#else
|
||||
#define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION"_catch_sr
|
||||
#define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION"
|
||||
#endif
|
||||
|
||||
#endif // CATCH_PREPROCESSOR_INTERNAL_STRINGIFY_HPP_INCLUDED
|
||||
|
@@ -12,26 +12,30 @@
|
||||
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
namespace {
|
||||
struct kvPair {
|
||||
StringRef key, value;
|
||||
std::string_view key, value;
|
||||
};
|
||||
|
||||
kvPair splitKVPair(StringRef kvString) {
|
||||
auto splitPos = static_cast<size_t>(
|
||||
std::find( kvString.begin(), kvString.end(), '=' ) -
|
||||
kvString.begin() );
|
||||
kvPair splitKVPair(std::string_view kvString) {
|
||||
const auto splitPos = kvString.find_first_of('=');
|
||||
|
||||
return { kvString.substr( 0, splitPos ),
|
||||
kvString.substr( splitPos + 1, kvString.size() ) };
|
||||
const std::string_view key = kvString.substr( 0, splitPos );
|
||||
|
||||
std::string_view value;
|
||||
if (splitPos < kvString.size())
|
||||
value = kvString.substr( splitPos + 1, kvString.size() );
|
||||
|
||||
return { key, value };
|
||||
}
|
||||
}
|
||||
|
||||
namespace Detail {
|
||||
std::vector<std::string> splitReporterSpec( StringRef reporterSpec ) {
|
||||
std::vector<std::string> splitReporterSpec( std::string_view reporterSpec ) {
|
||||
static constexpr auto separator = "::";
|
||||
static constexpr size_t separatorSize = 2;
|
||||
|
||||
@@ -80,7 +84,7 @@ namespace Catch {
|
||||
return parts;
|
||||
}
|
||||
|
||||
std::optional<ColourMode> stringToColourMode( StringRef colourMode ) {
|
||||
std::optional<ColourMode> stringToColourMode( std::string_view colourMode ) {
|
||||
if ( colourMode == "default" ) {
|
||||
return ColourMode::PlatformDefault;
|
||||
} else if ( colourMode == "ansi" ) {
|
||||
@@ -103,7 +107,7 @@ namespace Catch {
|
||||
lhs.m_customOptions == rhs.m_customOptions;
|
||||
}
|
||||
|
||||
std::optional<ReporterSpec> parseReporterSpec( StringRef reporterSpec ) {
|
||||
std::optional<ReporterSpec> parseReporterSpec( std::string_view reporterSpec ) {
|
||||
auto parts = Detail::splitReporterSpec( reporterSpec );
|
||||
|
||||
assert( parts.size() > 0 && "Split should never return empty vector" );
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#define CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED
|
||||
|
||||
#include <catch2/interfaces/catch_interfaces_config.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
@@ -22,9 +21,9 @@ namespace Catch {
|
||||
|
||||
namespace Detail {
|
||||
//! Splits the reporter spec into reporter name and kv-pair options
|
||||
std::vector<std::string> splitReporterSpec( StringRef reporterSpec );
|
||||
std::vector<std::string> splitReporterSpec( std::string_view reporterSpec );
|
||||
|
||||
std::optional<ColourMode> stringToColourMode( StringRef colourMode );
|
||||
std::optional<ColourMode> stringToColourMode( std::string_view colourMode );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +77,7 @@ namespace Catch {
|
||||
* * empty key/value in an custom kv pair
|
||||
* * ...
|
||||
*/
|
||||
std::optional<ReporterSpec> parseReporterSpec( StringRef reporterSpec );
|
||||
std::optional<ReporterSpec> parseReporterSpec( std::string_view reporterSpec );
|
||||
|
||||
}
|
||||
|
||||
|
@@ -366,7 +366,7 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
|
||||
bool RunContext::sectionStarted( StringRef sectionName,
|
||||
bool RunContext::sectionStarted( std::string_view sectionName,
|
||||
SourceLineInfo const& sectionLineInfo,
|
||||
Counts& assertions ) {
|
||||
ITracker& sectionTracker =
|
||||
@@ -392,7 +392,7 @@ namespace Catch {
|
||||
return true;
|
||||
}
|
||||
IGeneratorTracker*
|
||||
RunContext::acquireGeneratorTracker( StringRef generatorName,
|
||||
RunContext::acquireGeneratorTracker( std::string_view generatorName,
|
||||
SourceLineInfo const& lineInfo ) {
|
||||
auto* tracker = Generators::GeneratorTracker::acquire(
|
||||
m_trackerContext,
|
||||
@@ -403,7 +403,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
IGeneratorTracker* RunContext::createGeneratorTracker(
|
||||
StringRef generatorName,
|
||||
std::string_view generatorName,
|
||||
SourceLineInfo lineInfo,
|
||||
Generators::GeneratorBasePtr&& generator ) {
|
||||
|
||||
@@ -466,7 +466,7 @@ namespace Catch {
|
||||
m_unfinishedSections.push_back(CATCH_MOVE(endInfo));
|
||||
}
|
||||
|
||||
void RunContext::benchmarkPreparing( StringRef name ) {
|
||||
void RunContext::benchmarkPreparing( std::string_view name ) {
|
||||
auto _ = scopedDeactivate( *m_outputRedirect );
|
||||
m_reporter->benchmarkPreparing( name );
|
||||
}
|
||||
@@ -478,7 +478,7 @@ namespace Catch {
|
||||
auto _ = scopedDeactivate( *m_outputRedirect );
|
||||
m_reporter->benchmarkEnded( stats );
|
||||
}
|
||||
void RunContext::benchmarkFailed( StringRef error ) {
|
||||
void RunContext::benchmarkFailed( std::string_view error ) {
|
||||
auto _ = scopedDeactivate( *m_outputRedirect );
|
||||
m_reporter->benchmarkFailed( error );
|
||||
}
|
||||
@@ -531,7 +531,7 @@ namespace Catch {
|
||||
m_shouldReportUnexpected = false;
|
||||
}
|
||||
|
||||
void RunContext::handleFatalErrorCondition( StringRef message ) {
|
||||
void RunContext::handleFatalErrorCondition( std::string_view message ) {
|
||||
// We lock only when touching the reporters directly, to avoid
|
||||
// deadlocks when we call into other functions that also want
|
||||
// to lock the mutex before touching reporters.
|
||||
@@ -791,9 +791,9 @@ namespace Catch {
|
||||
m_activeTestCase->getTestCaseInfo().lineInfo;
|
||||
|
||||
return AssertionInfo{
|
||||
testCaseJustStarted ? "TEST_CASE"_sr : StringRef(),
|
||||
testCaseJustStarted ? "TEST_CASE" : std::string_view(),
|
||||
Detail::g_lastKnownLineInfo,
|
||||
testCaseJustStarted ? StringRef() : "{Unknown expression after the reported line}"_sr,
|
||||
testCaseJustStarted ? std::string_view() : "{Unknown expression after the reported line}",
|
||||
ResultDisposition::Normal
|
||||
};
|
||||
}
|
||||
|
@@ -73,7 +73,7 @@ namespace Catch {
|
||||
AssertionReaction &reaction ) override;
|
||||
|
||||
void notifyAssertionStarted( AssertionInfo const& info ) override;
|
||||
bool sectionStarted( StringRef sectionName,
|
||||
bool sectionStarted( std::string_view sectionName,
|
||||
SourceLineInfo const& sectionLineInfo,
|
||||
Counts& assertions ) override;
|
||||
|
||||
@@ -81,18 +81,18 @@ namespace Catch {
|
||||
void sectionEndedEarly( SectionEndInfo&& endInfo ) override;
|
||||
|
||||
IGeneratorTracker*
|
||||
acquireGeneratorTracker( StringRef generatorName,
|
||||
acquireGeneratorTracker( std::string_view generatorName,
|
||||
SourceLineInfo const& lineInfo ) override;
|
||||
IGeneratorTracker* createGeneratorTracker(
|
||||
StringRef generatorName,
|
||||
std::string_view generatorName,
|
||||
SourceLineInfo lineInfo,
|
||||
Generators::GeneratorBasePtr&& generator ) override;
|
||||
|
||||
|
||||
void benchmarkPreparing( StringRef name ) override;
|
||||
void benchmarkPreparing( std::string_view name ) override;
|
||||
void benchmarkStarting( BenchmarkInfo const& info ) override;
|
||||
void benchmarkEnded( BenchmarkStats<> const& stats ) override;
|
||||
void benchmarkFailed( StringRef error ) override;
|
||||
void benchmarkFailed( std::string_view error ) override;
|
||||
|
||||
void pushScopedMessage( MessageInfo&& message ) override;
|
||||
void popScopedMessage( unsigned int messageId ) override;
|
||||
@@ -105,7 +105,7 @@ namespace Catch {
|
||||
|
||||
void exceptionEarlyReported() override;
|
||||
|
||||
void handleFatalErrorCondition( StringRef message ) override;
|
||||
void handleFatalErrorCondition( std::string_view message ) override;
|
||||
|
||||
bool lastAssertionPassed() override;
|
||||
|
||||
|
@@ -24,7 +24,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Section::Section( SourceLineInfo const& _lineInfo,
|
||||
StringRef _name,
|
||||
std::string_view _name,
|
||||
const char* const ):
|
||||
m_info( { "invalid", static_cast<std::size_t>( -1 ) }, std::string{} ),
|
||||
m_sectionIncluded(
|
||||
|
@@ -22,7 +22,7 @@ namespace Catch {
|
||||
public:
|
||||
Section( SectionInfo&& info );
|
||||
Section( SourceLineInfo const& _lineInfo,
|
||||
StringRef _name,
|
||||
std::string_view _name,
|
||||
const char* const = nullptr );
|
||||
~Section();
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Catch {
|
||||
// symbol for static analysis.
|
||||
// The arguments are used as a dummy for checking warnings in the passed
|
||||
// expressions.
|
||||
int GetNewSectionHint( StringRef, const char* const = nullptr );
|
||||
int GetNewSectionHint( std::string_view, const char* const = nullptr );
|
||||
} // namespace Detail
|
||||
} // namespace Catch
|
||||
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#ifndef CATCH_STREAM_END_STOP_HPP_INCLUDED
|
||||
#define CATCH_STREAM_END_STOP_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <string_view>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Catch {
|
||||
// as well as
|
||||
// << stuff +StreamEndStop
|
||||
struct StreamEndStop {
|
||||
constexpr StringRef operator+() const { return StringRef(); }
|
||||
constexpr std::string_view operator+() const { return std::string_view(); }
|
||||
|
||||
template <typename T>
|
||||
constexpr friend T const& operator+( T const& value, StreamEndStop ) {
|
||||
|
@@ -7,28 +7,28 @@
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||
#include <catch2/internal/catch_string_manip.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <ostream>
|
||||
#include <cstring>
|
||||
#include <cctype>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
bool startsWith( std::string const& s, std::string const& prefix ) {
|
||||
bool startsWith( std::string_view s, std::string_view prefix ) {
|
||||
return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());
|
||||
}
|
||||
bool startsWith( StringRef s, char prefix ) {
|
||||
bool startsWith( std::string_view s, char prefix ) {
|
||||
return !s.empty() && s[0] == prefix;
|
||||
}
|
||||
bool endsWith( std::string const& s, std::string const& suffix ) {
|
||||
bool endsWith( std::string_view s, std::string_view suffix ) {
|
||||
return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin());
|
||||
}
|
||||
bool endsWith( std::string const& s, char suffix ) {
|
||||
bool endsWith( std::string_view s, char suffix ) {
|
||||
return !s.empty() && s[s.size()-1] == suffix;
|
||||
}
|
||||
bool contains( std::string const& s, std::string const& infix ) {
|
||||
bool contains( std::string_view s, std::string_view infix ) {
|
||||
return s.find( infix ) != std::string::npos;
|
||||
}
|
||||
void toLowerInPlace( std::string& s ) {
|
||||
@@ -36,8 +36,8 @@ namespace Catch {
|
||||
c = toLower( c );
|
||||
}
|
||||
}
|
||||
std::string toLower( std::string const& s ) {
|
||||
std::string lc = s;
|
||||
std::string toLower( std::string_view s ) {
|
||||
std::string lc(s);
|
||||
toLowerInPlace( lc );
|
||||
return lc;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace Catch {
|
||||
return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string();
|
||||
}
|
||||
|
||||
StringRef trim(StringRef ref) {
|
||||
std::string_view trim(std::string_view ref) {
|
||||
const auto is_ws = [](char c) {
|
||||
return c == ' ' || c == '\t' || c == '\n' || c == '\r';
|
||||
};
|
||||
@@ -65,7 +65,7 @@ namespace Catch {
|
||||
return ref.substr(real_begin, real_end - real_begin);
|
||||
}
|
||||
|
||||
bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {
|
||||
bool replaceInPlace( std::string& str, std::string_view replaceThis, std::string_view withThis ) {
|
||||
std::size_t i = str.find( replaceThis );
|
||||
if (i == std::string::npos) {
|
||||
return false;
|
||||
@@ -91,8 +91,8 @@ namespace Catch {
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) {
|
||||
std::vector<StringRef> subStrings;
|
||||
std::vector<std::string_view> splitStringRef( std::string_view str, char delimiter ) {
|
||||
std::vector<std::string_view> subStrings;
|
||||
std::size_t start = 0;
|
||||
for(std::size_t pos = 0; pos < str.size(); ++pos ) {
|
||||
if( str[pos] == delimiter ) {
|
||||
|
@@ -8,31 +8,30 @@
|
||||
#ifndef CATCH_STRING_MANIP_HPP_INCLUDED
|
||||
#define CATCH_STRING_MANIP_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
bool startsWith( std::string const& s, std::string const& prefix );
|
||||
bool startsWith( StringRef s, char prefix );
|
||||
bool endsWith( std::string const& s, std::string const& suffix );
|
||||
bool endsWith( std::string const& s, char suffix );
|
||||
bool contains( std::string const& s, std::string const& infix );
|
||||
bool startsWith( std::string_view s, std::string_view prefix );
|
||||
bool startsWith( std::string_view s, char prefix );
|
||||
bool endsWith( std::string_view s, std::string_view suffix );
|
||||
bool endsWith( std::string_view s, char suffix );
|
||||
bool contains( std::string_view s, std::string_view infix );
|
||||
void toLowerInPlace( std::string& s );
|
||||
std::string toLower( std::string const& s );
|
||||
std::string toLower( std::string_view s );
|
||||
char toLower( char c );
|
||||
//! Returns a new string without whitespace at the start/end
|
||||
std::string trim( std::string const& str );
|
||||
//! Returns a substring of the original ref without whitespace. Beware lifetimes!
|
||||
StringRef trim(StringRef ref);
|
||||
std::string_view trim(std::string_view ref);
|
||||
|
||||
// !!! Be aware, returns refs into original string - make sure original string outlives them
|
||||
std::vector<StringRef> splitStringRef( StringRef str, char delimiter );
|
||||
bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );
|
||||
std::vector<std::string_view> splitStringRef( std::string_view str, char delimiter );
|
||||
bool replaceInPlace( std::string& str, std::string_view replaceThis, std::string_view withThis );
|
||||
|
||||
/**
|
||||
* Helper for streaming a "count [maybe-plural-of-label]" human-friendly string
|
||||
@@ -46,10 +45,10 @@ namespace Catch {
|
||||
*/
|
||||
class pluralise {
|
||||
std::uint64_t m_count;
|
||||
StringRef m_label;
|
||||
std::string_view m_label;
|
||||
|
||||
public:
|
||||
constexpr pluralise(std::uint64_t count, StringRef label):
|
||||
constexpr pluralise(std::uint64_t count, std::string_view label):
|
||||
m_count(count),
|
||||
m_label(label)
|
||||
{}
|
||||
|
@@ -1,65 +0,0 @@
|
||||
|
||||
// Copyright Catch2 Authors
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE.txt or copy at
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <ostream>
|
||||
#include <cstring>
|
||||
|
||||
namespace Catch {
|
||||
StringRef::StringRef( char const* rawChars ) noexcept
|
||||
: StringRef( rawChars, std::strlen(rawChars) )
|
||||
{}
|
||||
|
||||
|
||||
bool StringRef::operator<(StringRef rhs) const noexcept {
|
||||
if (m_size < rhs.m_size) {
|
||||
return strncmp(m_start, rhs.m_start, m_size) <= 0;
|
||||
}
|
||||
return strncmp(m_start, rhs.m_start, rhs.m_size) < 0;
|
||||
}
|
||||
|
||||
int StringRef::compare( StringRef rhs ) const {
|
||||
auto cmpResult =
|
||||
strncmp( m_start, rhs.m_start, std::min( m_size, rhs.m_size ) );
|
||||
|
||||
// This means that strncmp found a difference before the strings
|
||||
// ended, and we can return it directly
|
||||
if ( cmpResult != 0 ) {
|
||||
return cmpResult;
|
||||
}
|
||||
|
||||
// If strings are equal up to length, then their comparison results on
|
||||
// their size
|
||||
if ( m_size < rhs.m_size ) {
|
||||
return -1;
|
||||
} else if ( m_size > rhs.m_size ) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
auto operator << ( std::ostream& os, StringRef str ) -> std::ostream& {
|
||||
return os.write(str.data(), static_cast<std::streamsize>(str.size()));
|
||||
}
|
||||
|
||||
std::string operator+(StringRef lhs, StringRef rhs) {
|
||||
std::string ret;
|
||||
ret.reserve(lhs.size() + rhs.size());
|
||||
ret += lhs;
|
||||
ret += rhs;
|
||||
return ret;
|
||||
}
|
||||
|
||||
auto operator+=( std::string& lhs, StringRef rhs ) -> std::string& {
|
||||
lhs.append(rhs.data(), rhs.size());
|
||||
return lhs;
|
||||
}
|
||||
|
||||
} // namespace Catch
|
@@ -1,123 +0,0 @@
|
||||
|
||||
// Copyright Catch2 Authors
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE.txt or copy at
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
#ifndef CATCH_STRINGREF_HPP_INCLUDED
|
||||
#define CATCH_STRINGREF_HPP_INCLUDED
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <iosfwd>
|
||||
#include <cassert>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
/// A non-owning string class (similar to the forthcoming std::string_view)
|
||||
/// Note that, because a StringRef may be a substring of another string,
|
||||
/// it may not be null terminated.
|
||||
class StringRef {
|
||||
public:
|
||||
using size_type = std::size_t;
|
||||
using const_iterator = const char*;
|
||||
|
||||
static constexpr size_type npos{ static_cast<size_type>( -1 ) };
|
||||
|
||||
private:
|
||||
static constexpr char const* const s_empty = "";
|
||||
|
||||
char const* m_start = s_empty;
|
||||
size_type m_size = 0;
|
||||
|
||||
public: // construction
|
||||
constexpr StringRef() noexcept = default;
|
||||
|
||||
StringRef( char const* rawChars ) noexcept;
|
||||
|
||||
constexpr StringRef( char const* rawChars, size_type size ) noexcept
|
||||
: m_start( rawChars ),
|
||||
m_size( size )
|
||||
{}
|
||||
|
||||
StringRef( std::string const& stdString ) noexcept
|
||||
: m_start( stdString.c_str() ),
|
||||
m_size( stdString.size() )
|
||||
{}
|
||||
|
||||
explicit operator std::string() const {
|
||||
return std::string(m_start, m_size);
|
||||
}
|
||||
|
||||
public: // operators
|
||||
auto operator == ( StringRef other ) const noexcept -> bool {
|
||||
return m_size == other.m_size
|
||||
&& (std::memcmp( m_start, other.m_start, m_size ) == 0);
|
||||
}
|
||||
auto operator != (StringRef other) const noexcept -> bool {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
constexpr auto operator[] ( size_type index ) const noexcept -> char {
|
||||
assert(index < m_size);
|
||||
return m_start[index];
|
||||
}
|
||||
|
||||
bool operator<(StringRef rhs) const noexcept;
|
||||
|
||||
public: // named queries
|
||||
constexpr auto empty() const noexcept -> bool {
|
||||
return m_size == 0;
|
||||
}
|
||||
constexpr auto size() const noexcept -> size_type {
|
||||
return m_size;
|
||||
}
|
||||
|
||||
// Returns a substring of [start, start + length).
|
||||
// If start + length > size(), then the substring is [start, size()).
|
||||
// If start > size(), then the substring is empty.
|
||||
constexpr StringRef substr(size_type start, size_type length) const noexcept {
|
||||
if (start < m_size) {
|
||||
const auto shortened_size = m_size - start;
|
||||
return StringRef(m_start + start, (shortened_size < length) ? shortened_size : length);
|
||||
} else {
|
||||
return StringRef();
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the current start pointer. May not be null-terminated.
|
||||
constexpr char const* data() const noexcept {
|
||||
return m_start;
|
||||
}
|
||||
|
||||
constexpr const_iterator begin() const { return m_start; }
|
||||
constexpr const_iterator end() const { return m_start + m_size; }
|
||||
|
||||
|
||||
friend std::string& operator += (std::string& lhs, StringRef rhs);
|
||||
friend std::ostream& operator << (std::ostream& os, StringRef str);
|
||||
friend std::string operator+(StringRef lhs, StringRef rhs);
|
||||
|
||||
/**
|
||||
* Provides a three-way comparison with rhs
|
||||
*
|
||||
* Returns negative number if lhs < rhs, 0 if lhs == rhs, and a positive
|
||||
* number if lhs > rhs
|
||||
*/
|
||||
int compare( StringRef rhs ) const;
|
||||
};
|
||||
|
||||
|
||||
constexpr auto operator ""_sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {
|
||||
return StringRef( rawChars, size );
|
||||
}
|
||||
} // namespace Catch
|
||||
|
||||
constexpr auto operator ""_catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef {
|
||||
return Catch::StringRef( rawChars, size );
|
||||
}
|
||||
|
||||
#endif // CATCH_STRINGREF_HPP_INCLUDED
|
@@ -135,7 +135,7 @@
|
||||
constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\
|
||||
constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\
|
||||
constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + '<' + types_list[index % num_types] + '>', Tags } ), index++)... };/* NOLINT */\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, std::string_view(), Catch::NameAndTags{ Name " - " + std::string(tmpl_types[index / num_types]) + '<' + types_list[index % num_types] + '>', Tags } ), index++)... };/* NOLINT */\
|
||||
} \
|
||||
}; \
|
||||
static const int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
|
||||
@@ -181,7 +181,7 @@
|
||||
void reg_tests() { \
|
||||
size_t index = 0; \
|
||||
using expander = size_t[]; \
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name " - " INTERNAL_CATCH_STRINGIZE(TmplList) " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, std::string_view(), Catch::NameAndTags{ Name " - " INTERNAL_CATCH_STRINGIZE(TmplList) " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */\
|
||||
} \
|
||||
};\
|
||||
static const int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \
|
||||
@@ -316,7 +316,7 @@
|
||||
void reg_tests(){\
|
||||
size_t index = 0;\
|
||||
using expander = size_t[];\
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName##_catch_sr, Catch::NameAndTags{ Name " - " INTERNAL_CATCH_STRINGIZE(TmplList) " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \
|
||||
(void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name " - " INTERNAL_CATCH_STRINGIZE(TmplList) " - " + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \
|
||||
}\
|
||||
};\
|
||||
static const int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\
|
||||
|
@@ -157,7 +157,7 @@ namespace TestCaseTracking {
|
||||
|
||||
SectionTracker::SectionTracker( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent )
|
||||
: TrackerBase( CATCH_MOVE(nameAndLocation), ctx, parent ),
|
||||
m_trimmed_name(trim(StringRef(ITracker::nameAndLocation().name)))
|
||||
m_trimmed_name(trim(std::string_view(ITracker::nameAndLocation().name)))
|
||||
{
|
||||
if( parent ) {
|
||||
while ( !parent->isSectionTracker() ) {
|
||||
@@ -216,17 +216,17 @@ namespace TestCaseTracking {
|
||||
void SectionTracker::addInitialFilters( std::vector<std::string> const& filters ) {
|
||||
if( !filters.empty() ) {
|
||||
m_filters.reserve( m_filters.size() + filters.size() + 2 );
|
||||
m_filters.emplace_back(StringRef{}); // Root - should never be consulted
|
||||
m_filters.emplace_back(StringRef{}); // Test Case - not a section filter
|
||||
m_filters.emplace_back(); // Root - should never be consulted
|
||||
m_filters.emplace_back(); // Test Case - not a section filter
|
||||
m_filters.insert( m_filters.end(), filters.begin(), filters.end() );
|
||||
}
|
||||
}
|
||||
void SectionTracker::addNextFilters( std::vector<StringRef> const& filters ) {
|
||||
void SectionTracker::addNextFilters( std::vector<std::string_view> const& filters ) {
|
||||
if( filters.size() > 1 )
|
||||
m_filters.insert( m_filters.end(), filters.begin()+1, filters.end() );
|
||||
}
|
||||
|
||||
StringRef SectionTracker::trimmedName() const {
|
||||
std::string_view SectionTracker::trimmedName() const {
|
||||
return m_trimmed_name;
|
||||
}
|
||||
|
||||
|
@@ -10,9 +10,9 @@
|
||||
|
||||
#include <catch2/internal/catch_source_line_info.hpp>
|
||||
#include <catch2/internal/catch_unique_ptr.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace Catch {
|
||||
@@ -45,10 +45,10 @@ namespace TestCaseTracking {
|
||||
* around the owning variant.
|
||||
*/
|
||||
struct NameAndLocationRef {
|
||||
StringRef name;
|
||||
std::string_view name;
|
||||
SourceLineInfo location;
|
||||
|
||||
constexpr NameAndLocationRef( StringRef name_,
|
||||
constexpr NameAndLocationRef( std::string_view name_,
|
||||
SourceLineInfo location_ ):
|
||||
name( name_ ), location( location_ ) {}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace TestCaseTracking {
|
||||
// cost of repeating is trivial at that point (we will be paying
|
||||
// multiple strcmp/memcmps at that point).
|
||||
if ( lhs.location.line != rhs.location.line ) { return false; }
|
||||
return StringRef( lhs.name ) == rhs.name &&
|
||||
return std::string_view( lhs.name ) == rhs.name &&
|
||||
lhs.location == rhs.location;
|
||||
}
|
||||
friend bool operator==( NameAndLocationRef const& lhs,
|
||||
@@ -208,12 +208,12 @@ namespace TestCaseTracking {
|
||||
};
|
||||
|
||||
class SectionTracker : public TrackerBase {
|
||||
std::vector<StringRef> m_filters;
|
||||
std::vector<std::string_view> m_filters;
|
||||
// Note that lifetime-wise we piggy back off the name stored in the `ITracker` parent`.
|
||||
// Currently it allocates owns the name, so this is safe. If it is later refactored
|
||||
// to not own the name, the name still has to outlive the `ITracker` parent, so
|
||||
// this should still be safe.
|
||||
StringRef m_trimmed_name;
|
||||
std::string_view m_trimmed_name;
|
||||
public:
|
||||
SectionTracker( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent );
|
||||
|
||||
@@ -226,11 +226,11 @@ namespace TestCaseTracking {
|
||||
void tryOpen();
|
||||
|
||||
void addInitialFilters( std::vector<std::string> const& filters );
|
||||
void addNextFilters( std::vector<StringRef> const& filters );
|
||||
void addNextFilters( std::vector<std::string_view> const& filters );
|
||||
//! Returns filters active in this tracker
|
||||
std::vector<StringRef> const& getFilters() const { return m_filters; }
|
||||
std::vector<std::string_view> const& getFilters() const { return m_filters; }
|
||||
//! Returns whitespace-trimmed name of the tracked section
|
||||
StringRef trimmedName() const;
|
||||
std::string_view trimmedName() const;
|
||||
};
|
||||
|
||||
} // namespace TestCaseTracking
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#include <catch2/internal/catch_assertion_handler.hpp>
|
||||
#include <catch2/internal/catch_preprocessor_internal_stringify.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_capture.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_source_line_info.hpp>
|
||||
|
||||
// We need this suppression to leak, because it took until GCC 10
|
||||
@@ -43,7 +42,7 @@
|
||||
do { /* NOLINT(bugprone-infinite-loop) */ \
|
||||
/* The expression should not be evaluated, but warnings should hopefully be checked */ \
|
||||
CATCH_INTERNAL_IGNORE_BUT_WARN(__VA_ARGS__); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
|
||||
INTERNAL_CATCH_TRY { \
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
|
||||
CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \
|
||||
@@ -67,7 +66,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \
|
||||
try { \
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
|
||||
CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \
|
||||
@@ -84,7 +83,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \
|
||||
if( catchAssertionHandler.allowThrows() ) \
|
||||
try { \
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
|
||||
@@ -105,7 +104,7 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \
|
||||
if( catchAssertionHandler.allowThrows() ) \
|
||||
try { \
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
|
||||
@@ -132,7 +131,7 @@
|
||||
// Although this is matcher-based, it can be used with just a string
|
||||
#define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
|
||||
if( catchAssertionHandler.allowThrows() ) \
|
||||
try { \
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
|
||||
|
@@ -21,7 +21,7 @@ namespace Catch {
|
||||
ITestInvoker::~ITestInvoker() = default;
|
||||
|
||||
namespace {
|
||||
static StringRef extractClassName( StringRef classOrMethodName ) {
|
||||
static std::string_view extractClassName( std::string_view classOrMethodName ) {
|
||||
if ( !startsWith( classOrMethodName, '&' ) ) {
|
||||
return classOrMethodName;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace Catch {
|
||||
return Detail::make_unique<TestInvokerAsFunction>( testAsFunction );
|
||||
}
|
||||
|
||||
AutoReg::AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept {
|
||||
AutoReg::AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, std::string_view classOrMethod, NameAndTags const& nameAndTags ) noexcept {
|
||||
CATCH_TRY {
|
||||
getMutableRegistryHub()
|
||||
.registerTest(
|
||||
|
@@ -12,18 +12,11 @@
|
||||
#include <catch2/internal/catch_source_line_info.hpp>
|
||||
#include <catch2/internal/catch_noncopyable.hpp>
|
||||
#include <catch2/interfaces/catch_interfaces_test_invoker.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_unique_ptr.hpp>
|
||||
#include <catch2/internal/catch_unique_name.hpp>
|
||||
#include <catch2/internal/catch_preprocessor_remove_parens.hpp>
|
||||
|
||||
// GCC 5 and older do not properly handle disabling unused-variable warning
|
||||
// with a _Pragma. This means that we have to leak the suppression to the
|
||||
// user code as well :-(
|
||||
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 5
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
|
||||
#include <string_view>
|
||||
|
||||
|
||||
namespace Catch {
|
||||
@@ -77,15 +70,15 @@ Detail::unique_ptr<ITestInvoker> makeTestInvokerFixture( void ( C::*testAsMethod
|
||||
}
|
||||
|
||||
struct NameAndTags {
|
||||
constexpr NameAndTags( StringRef name_ = StringRef(),
|
||||
StringRef tags_ = StringRef() ) noexcept:
|
||||
constexpr NameAndTags( std::string_view name_ = {},
|
||||
std::string_view tags_ = {} ) noexcept:
|
||||
name( name_ ), tags( tags_ ) {}
|
||||
StringRef name;
|
||||
StringRef tags;
|
||||
std::string_view name;
|
||||
std::string_view tags;
|
||||
};
|
||||
|
||||
struct AutoReg : Detail::NonCopyable {
|
||||
AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept;
|
||||
AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, std::string_view classOrMethod, NameAndTags const& nameAndTags ) noexcept;
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
@@ -111,7 +104,7 @@ struct AutoReg : Detail::NonCopyable {
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||
CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
|
||||
namespace{ const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
|
||||
namespace{ const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, std::string_view(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
|
||||
static void TestName()
|
||||
#define INTERNAL_CATCH_TESTCASE( ... ) \
|
||||
@@ -164,7 +157,7 @@ static int catchInternalSectionHint = 0;
|
||||
const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \
|
||||
Catch::makeTestInvoker( &TestName::test ), \
|
||||
CATCH_INTERNAL_LINEINFO, \
|
||||
#ClassName##_catch_sr, \
|
||||
#ClassName, \
|
||||
Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
} \
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
|
||||
@@ -184,7 +177,7 @@ static int catchInternalSectionHint = 0;
|
||||
const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \
|
||||
Catch::makeTestInvokerFixture( &TestName::test ), \
|
||||
CATCH_INTERNAL_LINEINFO, \
|
||||
#ClassName##_catch_sr, \
|
||||
#ClassName, \
|
||||
Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
} \
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
|
||||
@@ -202,7 +195,7 @@ static int catchInternalSectionHint = 0;
|
||||
const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \
|
||||
Catch::makeTestInvoker( &QualifiedMethod ), \
|
||||
CATCH_INTERNAL_LINEINFO, \
|
||||
"&" #QualifiedMethod##_catch_sr, \
|
||||
"&" #QualifiedMethod, \
|
||||
Catch::NameAndTags{ __VA_ARGS__ } ); \
|
||||
} /* NOLINT */ \
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
|
||||
@@ -214,7 +207,7 @@ static int catchInternalSectionHint = 0;
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \
|
||||
CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, std::string_view(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
|
||||
} while(false)
|
||||
|
||||
|
@@ -47,7 +47,7 @@ namespace {
|
||||
|
||||
void hexEscapeChar(std::ostream& os, unsigned char c) {
|
||||
std::ios_base::fmtflags f(os.flags());
|
||||
os << "\\x"_sr
|
||||
os << "\\x"
|
||||
<< std::uppercase << std::hex << std::setfill('0') << std::setw(2)
|
||||
<< static_cast<int>(c);
|
||||
os.flags(f);
|
||||
@@ -79,25 +79,25 @@ namespace {
|
||||
switch ( c ) {
|
||||
case '<':
|
||||
write_to( idx );
|
||||
os << "<"_sr;
|
||||
os << "<";
|
||||
break;
|
||||
case '&':
|
||||
write_to( idx );
|
||||
os << "&"_sr;
|
||||
os << "&";
|
||||
break;
|
||||
|
||||
case '>':
|
||||
// See: http://www.w3.org/TR/xml/#syntax
|
||||
if ( idx > 2 && m_str[idx - 1] == ']' && m_str[idx - 2] == ']' ) {
|
||||
write_to( idx );
|
||||
os << ">"_sr;
|
||||
os << ">";
|
||||
}
|
||||
break;
|
||||
|
||||
case '\"':
|
||||
if ( m_forWhat == ForAttributes ) {
|
||||
write_to( idx );
|
||||
os << """_sr;
|
||||
os << """;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -209,14 +209,14 @@ namespace {
|
||||
}
|
||||
|
||||
XmlWriter::ScopedElement&
|
||||
XmlWriter::ScopedElement::writeText( StringRef text, XmlFormatting fmt ) {
|
||||
XmlWriter::ScopedElement::writeText( std::string_view text, XmlFormatting fmt ) {
|
||||
m_writer->writeText( text, fmt );
|
||||
return *this;
|
||||
}
|
||||
|
||||
XmlWriter::ScopedElement&
|
||||
XmlWriter::ScopedElement::writeAttribute( StringRef name,
|
||||
StringRef attribute ) {
|
||||
XmlWriter::ScopedElement::writeAttribute( std::string_view name,
|
||||
std::string_view attribute ) {
|
||||
m_writer->writeAttribute( name, attribute );
|
||||
return *this;
|
||||
}
|
||||
@@ -273,25 +273,25 @@ namespace {
|
||||
return *this;
|
||||
}
|
||||
|
||||
XmlWriter& XmlWriter::writeAttribute( StringRef name,
|
||||
StringRef attribute ) {
|
||||
XmlWriter& XmlWriter::writeAttribute( std::string_view name,
|
||||
std::string_view attribute ) {
|
||||
if( !name.empty() && !attribute.empty() )
|
||||
m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"';
|
||||
return *this;
|
||||
}
|
||||
|
||||
XmlWriter& XmlWriter::writeAttribute( StringRef name, bool attribute ) {
|
||||
writeAttribute(name, (attribute ? "true"_sr : "false"_sr));
|
||||
XmlWriter& XmlWriter::writeAttribute( std::string_view name, bool attribute ) {
|
||||
writeAttribute(name, (attribute ? "true" : "false"));
|
||||
return *this;
|
||||
}
|
||||
|
||||
XmlWriter& XmlWriter::writeAttribute( StringRef name,
|
||||
XmlWriter& XmlWriter::writeAttribute( std::string_view name,
|
||||
char const* attribute ) {
|
||||
writeAttribute( name, StringRef( attribute ) );
|
||||
writeAttribute( name, std::string_view( attribute ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
XmlWriter& XmlWriter::writeText( StringRef text, XmlFormatting fmt ) {
|
||||
XmlWriter& XmlWriter::writeText( std::string_view text, XmlFormatting fmt ) {
|
||||
CATCH_ENFORCE(!m_tags.empty(), "Cannot write text as top level element");
|
||||
if( !text.empty() ){
|
||||
bool tagWasOpen = m_tagIsOpen;
|
||||
@@ -305,7 +305,7 @@ namespace {
|
||||
return *this;
|
||||
}
|
||||
|
||||
XmlWriter& XmlWriter::writeComment( StringRef text, XmlFormatting fmt ) {
|
||||
XmlWriter& XmlWriter::writeComment( std::string_view text, XmlFormatting fmt ) {
|
||||
ensureTagClosed();
|
||||
if (shouldIndent(fmt)) {
|
||||
m_os << m_indent;
|
||||
@@ -315,7 +315,7 @@ namespace {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void XmlWriter::writeStylesheetRef( StringRef url ) {
|
||||
void XmlWriter::writeStylesheetRef( std::string_view url ) {
|
||||
m_os << R"(<?xml-stylesheet type="text/xsl" href=")" << url << R"("?>)" << '\n';
|
||||
}
|
||||
|
||||
|
@@ -9,11 +9,11 @@
|
||||
#define CATCH_XMLWRITER_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_reusable_string_stream.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <iosfwd>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
#include <string_view>
|
||||
|
||||
namespace Catch {
|
||||
enum class XmlFormatting : std::uint8_t {
|
||||
@@ -43,7 +43,7 @@ namespace Catch {
|
||||
public:
|
||||
enum ForWhat { ForTextNodes, ForAttributes };
|
||||
|
||||
constexpr XmlEncode( StringRef str, ForWhat forWhat = ForTextNodes ):
|
||||
constexpr XmlEncode( std::string_view str, ForWhat forWhat = ForTextNodes ):
|
||||
m_str( str ), m_forWhat( forWhat ) {}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Catch {
|
||||
friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode );
|
||||
|
||||
private:
|
||||
StringRef m_str;
|
||||
std::string_view m_str;
|
||||
ForWhat m_forWhat;
|
||||
};
|
||||
|
||||
@@ -69,20 +69,20 @@ namespace Catch {
|
||||
~ScopedElement();
|
||||
|
||||
ScopedElement&
|
||||
writeText( StringRef text,
|
||||
writeText( std::string_view text,
|
||||
XmlFormatting fmt = XmlFormatting::Newline |
|
||||
XmlFormatting::Indent );
|
||||
|
||||
ScopedElement& writeAttribute( StringRef name,
|
||||
StringRef attribute );
|
||||
ScopedElement& writeAttribute( std::string_view name,
|
||||
std::string_view attribute );
|
||||
template <typename T,
|
||||
// Without this SFINAE, this overload is a better match
|
||||
// for `std::string`, `char const*`, `char const[N]` args.
|
||||
// While it would still work, it would cause code bloat
|
||||
// and multiple iteration over the strings
|
||||
typename = typename std::enable_if_t<
|
||||
!std::is_convertible_v<T, StringRef>>>
|
||||
ScopedElement& writeAttribute( StringRef name,
|
||||
!std::is_convertible_v<T, std::string_view>>>
|
||||
ScopedElement& writeAttribute( std::string_view name,
|
||||
T const& attribute ) {
|
||||
m_writer->writeAttribute( name, attribute );
|
||||
return *this;
|
||||
@@ -106,13 +106,13 @@ namespace Catch {
|
||||
XmlWriter& endElement(XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent);
|
||||
|
||||
//! The attribute content is XML-encoded
|
||||
XmlWriter& writeAttribute( StringRef name, StringRef attribute );
|
||||
XmlWriter& writeAttribute( std::string_view name, std::string_view attribute );
|
||||
|
||||
//! Writes the attribute as "true/false"
|
||||
XmlWriter& writeAttribute( StringRef name, bool attribute );
|
||||
XmlWriter& writeAttribute( std::string_view name, bool attribute );
|
||||
|
||||
//! The attribute content is XML-encoded
|
||||
XmlWriter& writeAttribute( StringRef name, char const* attribute );
|
||||
XmlWriter& writeAttribute( std::string_view name, char const* attribute );
|
||||
|
||||
//! The attribute value must provide op<<(ostream&, T). The resulting
|
||||
//! serialization is XML-encoded
|
||||
@@ -122,24 +122,24 @@ namespace Catch {
|
||||
// While it would still work, it would cause code bloat
|
||||
// and multiple iteration over the strings
|
||||
typename = typename std::enable_if_t<
|
||||
!std::is_convertible_v<T, StringRef>>>
|
||||
XmlWriter& writeAttribute( StringRef name, T const& attribute ) {
|
||||
!std::is_convertible_v<T, std::string_view>>>
|
||||
XmlWriter& writeAttribute( std::string_view name, T const& attribute ) {
|
||||
ReusableStringStream rss;
|
||||
rss << attribute;
|
||||
return writeAttribute( name, rss.str() );
|
||||
}
|
||||
|
||||
//! Writes escaped `text` in a element
|
||||
XmlWriter& writeText( StringRef text,
|
||||
XmlWriter& writeText( std::string_view text,
|
||||
XmlFormatting fmt = XmlFormatting::Newline |
|
||||
XmlFormatting::Indent );
|
||||
|
||||
//! Writes XML comment as "<!-- text -->"
|
||||
XmlWriter& writeComment( StringRef text,
|
||||
XmlWriter& writeComment( std::string_view text,
|
||||
XmlFormatting fmt = XmlFormatting::Newline |
|
||||
XmlFormatting::Indent );
|
||||
|
||||
void writeStylesheetRef( StringRef url );
|
||||
void writeStylesheetRef( std::string_view url );
|
||||
|
||||
void ensureTagClosed();
|
||||
|
||||
|
@@ -24,14 +24,14 @@ namespace Matchers {
|
||||
? toLower( str )
|
||||
: str;
|
||||
}
|
||||
StringRef CasedString::caseSensitivitySuffix() const {
|
||||
std::string_view CasedString::caseSensitivitySuffix() const {
|
||||
return m_caseSensitivity == CaseSensitive::Yes
|
||||
? StringRef()
|
||||
: " (case insensitive)"_sr;
|
||||
? std::string_view()
|
||||
: " (case insensitive)";
|
||||
}
|
||||
|
||||
|
||||
StringMatcherBase::StringMatcherBase( StringRef operation, CasedString const& comparator )
|
||||
StringMatcherBase::StringMatcherBase( std::string_view operation, CasedString const& comparator )
|
||||
: m_comparator( comparator ),
|
||||
m_operation( operation ) {
|
||||
}
|
||||
@@ -48,28 +48,28 @@ namespace Matchers {
|
||||
return description;
|
||||
}
|
||||
|
||||
StringEqualsMatcher::StringEqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals"_sr, comparator ) {}
|
||||
StringEqualsMatcher::StringEqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {}
|
||||
|
||||
bool StringEqualsMatcher::match( std::string const& source ) const {
|
||||
return m_comparator.adjustString( source ) == m_comparator.m_str;
|
||||
}
|
||||
|
||||
|
||||
StringContainsMatcher::StringContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains"_sr, comparator ) {}
|
||||
StringContainsMatcher::StringContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {}
|
||||
|
||||
bool StringContainsMatcher::match( std::string const& source ) const {
|
||||
return contains( m_comparator.adjustString( source ), m_comparator.m_str );
|
||||
}
|
||||
|
||||
|
||||
StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with"_sr, comparator ) {}
|
||||
StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with", comparator ) {}
|
||||
|
||||
bool StartsWithMatcher::match( std::string const& source ) const {
|
||||
return startsWith( m_comparator.adjustString( source ), m_comparator.m_str );
|
||||
}
|
||||
|
||||
|
||||
EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with"_sr, comparator ) {}
|
||||
EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with", comparator ) {}
|
||||
|
||||
bool EndsWithMatcher::match( std::string const& source ) const {
|
||||
return endsWith( m_comparator.adjustString( source ), m_comparator.m_str );
|
||||
|
@@ -8,11 +8,11 @@
|
||||
#ifndef CATCH_MATCHERS_STRING_HPP_INCLUDED
|
||||
#define CATCH_MATCHERS_STRING_HPP_INCLUDED
|
||||
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include <catch2/catch_case_sensitive.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace Catch {
|
||||
namespace Matchers {
|
||||
@@ -20,7 +20,7 @@ namespace Matchers {
|
||||
struct CasedString {
|
||||
CasedString( std::string const& str, CaseSensitive caseSensitivity );
|
||||
std::string adjustString( std::string const& str ) const;
|
||||
StringRef caseSensitivitySuffix() const;
|
||||
std::string_view caseSensitivitySuffix() const;
|
||||
|
||||
CaseSensitive m_caseSensitivity;
|
||||
std::string m_str;
|
||||
@@ -29,10 +29,10 @@ namespace Matchers {
|
||||
class StringMatcherBase : public MatcherBase<std::string> {
|
||||
protected:
|
||||
CasedString m_comparator;
|
||||
StringRef m_operation;
|
||||
std::string_view m_operation;
|
||||
|
||||
public:
|
||||
StringMatcherBase( StringRef operation,
|
||||
StringMatcherBase( std::string_view operation,
|
||||
CasedString const& comparator );
|
||||
std::string describe() const override;
|
||||
};
|
||||
|
@@ -13,7 +13,7 @@ namespace Matchers {
|
||||
|
||||
namespace Detail {
|
||||
|
||||
std::string describe_multi_matcher(StringRef combine, std::string const* descriptions_begin, std::string const* descriptions_end) {
|
||||
std::string describe_multi_matcher(std::string_view combine, std::string const* descriptions_begin, std::string const* descriptions_end) {
|
||||
std::string description;
|
||||
std::size_t combined_size = 4;
|
||||
for ( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) {
|
||||
|
@@ -9,12 +9,12 @@
|
||||
#define CATCH_MATCHERS_TEMPLATED_HPP_INCLUDED
|
||||
|
||||
#include <catch2/matchers/catch_matchers.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
|
||||
namespace Catch {
|
||||
@@ -93,10 +93,10 @@ namespace Matchers {
|
||||
return static_cast<T const*>(matchers[Idx])->match(arg) || match_any_of<MatcherTs...>(arg, matchers, std::index_sequence<Indices...>{});
|
||||
}
|
||||
|
||||
std::string describe_multi_matcher(StringRef combine, std::string const* descriptions_begin, std::string const* descriptions_end);
|
||||
std::string describe_multi_matcher(std::string_view combine, std::string const* descriptions_begin, std::string const* descriptions_end);
|
||||
|
||||
template<typename... MatcherTs, std::size_t... Idx>
|
||||
std::string describe_multi_matcher(StringRef combine, std::array<void const*, sizeof...(MatcherTs)> const& matchers, std::index_sequence<Idx...>) {
|
||||
std::string describe_multi_matcher(std::string_view combine, std::array<void const*, sizeof...(MatcherTs)> const& matchers, std::index_sequence<Idx...>) {
|
||||
std::array<std::string, sizeof...(MatcherTs)> descriptions {{
|
||||
static_cast<MatcherTs const*>(matchers[Idx])->toString()...
|
||||
}};
|
||||
@@ -122,7 +122,7 @@ namespace Matchers {
|
||||
}
|
||||
|
||||
std::string describe() const override {
|
||||
return describe_multi_matcher<MatcherTs...>(" and "_sr, m_matchers, std::index_sequence_for<MatcherTs...>{});
|
||||
return describe_multi_matcher<MatcherTs...>(" and ", m_matchers, std::index_sequence_for<MatcherTs...>{});
|
||||
}
|
||||
|
||||
// Has to be public to enable the concatenating operators
|
||||
@@ -177,7 +177,7 @@ namespace Matchers {
|
||||
}
|
||||
|
||||
std::string describe() const override {
|
||||
return describe_multi_matcher<MatcherTs...>(" or "_sr, m_matchers, std::index_sequence_for<MatcherTs...>{});
|
||||
return describe_multi_matcher<MatcherTs...>(" or ", m_matchers, std::index_sequence_for<MatcherTs...>{});
|
||||
}
|
||||
|
||||
|
||||
|
@@ -74,7 +74,7 @@ namespace Catch {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
|
||||
INTERNAL_CATCH_TRY { \
|
||||
catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher ) ); \
|
||||
} INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
|
||||
@@ -85,7 +85,7 @@ namespace Catch {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \
|
||||
do { \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(exceptionType) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
|
||||
Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(exceptionType) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \
|
||||
if( catchAssertionHandler.allowThrows() ) \
|
||||
try { \
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \
|
||||
|
@@ -132,7 +132,6 @@ internal_headers = [
|
||||
'internal/catch_stdstreams.hpp',
|
||||
'internal/catch_stream_end_stop.hpp',
|
||||
'internal/catch_string_manip.hpp',
|
||||
'internal/catch_stringref.hpp',
|
||||
'internal/catch_tag_alias_registry.hpp',
|
||||
'internal/catch_template_test_registry.hpp',
|
||||
'internal/catch_test_case_info_hasher.hpp',
|
||||
@@ -242,7 +241,6 @@ internal_sources = files(
|
||||
'internal/catch_startup_exception_registry.cpp',
|
||||
'internal/catch_stdstreams.cpp',
|
||||
'internal/catch_string_manip.cpp',
|
||||
'internal/catch_stringref.cpp',
|
||||
'internal/catch_tag_alias_registry.cpp',
|
||||
'internal/catch_test_case_info_hasher.cpp',
|
||||
'internal/catch_test_case_registry_impl.cpp',
|
||||
|
@@ -14,9 +14,9 @@
|
||||
#include <catch2/internal/catch_platform.hpp>
|
||||
#include <catch2/internal/catch_console_colour.hpp>
|
||||
#include <catch2/internal/catch_string_manip.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
|
||||
#include <ostream>
|
||||
#include <string_view>
|
||||
|
||||
namespace Catch {
|
||||
namespace {
|
||||
@@ -25,11 +25,11 @@ namespace {
|
||||
static constexpr Colour::Code compactDimColour = Colour::FileName;
|
||||
|
||||
#ifdef CATCH_PLATFORM_MAC
|
||||
static constexpr Catch::StringRef compactFailedString = "FAILED"_sr;
|
||||
static constexpr Catch::StringRef compactPassedString = "PASSED"_sr;
|
||||
static constexpr std::string_view compactFailedString = "FAILED";
|
||||
static constexpr std::string_view compactPassedString = "PASSED";
|
||||
#else
|
||||
static constexpr Catch::StringRef compactFailedString = "failed"_sr;
|
||||
static constexpr Catch::StringRef compactPassedString = "passed"_sr;
|
||||
static constexpr std::string_view compactFailedString = "failed";
|
||||
static constexpr std::string_view compactPassedString = "passed";
|
||||
#endif
|
||||
|
||||
// Implementation of CompactReporter formatting
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
break;
|
||||
case ResultWas::ExpressionFailed:
|
||||
if (result.isOk())
|
||||
printResultType(Colour::ResultSuccess, compactFailedString + " - but was ok"_sr);
|
||||
printResultType(Colour::ResultSuccess, std::string(compactFailedString) + " - but was ok");
|
||||
else
|
||||
printResultType(Colour::Error, compactFailedString);
|
||||
printOriginalExpression();
|
||||
@@ -91,12 +91,12 @@ public:
|
||||
printRemainingMessages();
|
||||
break;
|
||||
case ResultWas::Info:
|
||||
printResultType(Colour::None, "info"_sr);
|
||||
printResultType(Colour::None, "info");
|
||||
printMessage();
|
||||
printRemainingMessages();
|
||||
break;
|
||||
case ResultWas::Warning:
|
||||
printResultType(Colour::None, "warning"_sr);
|
||||
printResultType(Colour::None, "warning");
|
||||
printMessage();
|
||||
printRemainingMessages();
|
||||
break;
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
printRemainingMessages(Colour::None);
|
||||
break;
|
||||
case ResultWas::ExplicitSkip:
|
||||
printResultType(Colour::Skip, "skipped"_sr);
|
||||
printResultType(Colour::Skip, "skipped");
|
||||
printMessage();
|
||||
printRemainingMessages();
|
||||
break;
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
<< result.getSourceInfo() << ':';
|
||||
}
|
||||
|
||||
void printResultType(Colour::Code colour, StringRef passOrFail) const {
|
||||
void printResultType(Colour::Code colour, std::string_view passOrFail) const {
|
||||
if (!passOrFail.empty()) {
|
||||
stream << colourImpl->guardColour(colour) << ' ' << passOrFail;
|
||||
stream << ':';
|
||||
@@ -174,7 +174,7 @@ private:
|
||||
const auto N = static_cast<std::size_t>(itEnd - itMessage);
|
||||
|
||||
stream << colourImpl->guardColour( colour ) << " with "
|
||||
<< pluralise( N, "message"_sr ) << ':';
|
||||
<< pluralise( N, "message" ) << ':';
|
||||
|
||||
while (itMessage != itEnd) {
|
||||
// If this assertion is a warning ignore any INFO messages
|
||||
@@ -204,7 +204,7 @@ private:
|
||||
return "Reports test results on a single line, suitable for IDEs";
|
||||
}
|
||||
|
||||
void CompactReporter::noMatchingTestCases( StringRef unmatchedSpec ) {
|
||||
void CompactReporter::noMatchingTestCases( std::string_view unmatchedSpec ) {
|
||||
m_stream << "No test cases matched '" << unmatchedSpec << "'\n";
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ namespace Catch {
|
||||
|
||||
static std::string getDescription();
|
||||
|
||||
void noMatchingTestCases( StringRef unmatchedSpec ) override;
|
||||
void noMatchingTestCases( std::string_view unmatchedSpec ) override;
|
||||
|
||||
void testRunStarting( TestRunInfo const& _testInfo ) override;
|
||||
|
||||
|
@@ -14,7 +14,6 @@
|
||||
#include <catch2/catch_version.hpp>
|
||||
#include <catch2/internal/catch_textflow.hpp>
|
||||
#include <catch2/internal/catch_reusable_string_stream.hpp>
|
||||
#include <catch2/internal/catch_stringref.hpp>
|
||||
#include <catch2/catch_test_case_info.hpp>
|
||||
#include <catch2/internal/catch_console_width.hpp>
|
||||
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
||||
@@ -22,6 +21,7 @@
|
||||
#include <catch2/catch_get_random_seed.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
#include <string_view>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
@@ -57,78 +57,78 @@ public:
|
||||
switch (result.getResultType()) {
|
||||
case ResultWas::Ok:
|
||||
colour = Colour::Success;
|
||||
passOrFail = "PASSED"_sr;
|
||||
passOrFail = "PASSED";
|
||||
//if( result.hasMessage() )
|
||||
if (messages.size() == 1)
|
||||
messageLabel = "with message"_sr;
|
||||
messageLabel = "with message";
|
||||
if (messages.size() > 1)
|
||||
messageLabel = "with messages"_sr;
|
||||
messageLabel = "with messages";
|
||||
break;
|
||||
case ResultWas::ExpressionFailed:
|
||||
if (result.isOk()) {
|
||||
colour = Colour::Success;
|
||||
passOrFail = "FAILED - but was ok"_sr;
|
||||
passOrFail = "FAILED - but was ok";
|
||||
} else {
|
||||
colour = Colour::Error;
|
||||
passOrFail = "FAILED"_sr;
|
||||
passOrFail = "FAILED";
|
||||
}
|
||||
if (messages.size() == 1)
|
||||
messageLabel = "with message"_sr;
|
||||
messageLabel = "with message";
|
||||
if (messages.size() > 1)
|
||||
messageLabel = "with messages"_sr;
|
||||
messageLabel = "with messages";
|
||||
break;
|
||||
case ResultWas::ThrewException:
|
||||
colour = Colour::Error;
|
||||
passOrFail = "FAILED"_sr;
|
||||
passOrFail = "FAILED";
|
||||
// todo switch
|
||||
switch (messages.size()) { case 0:
|
||||
messageLabel = "due to unexpected exception with "_sr;
|
||||
messageLabel = "due to unexpected exception with ";
|
||||
break;
|
||||
case 1:
|
||||
messageLabel = "due to unexpected exception with message"_sr;
|
||||
messageLabel = "due to unexpected exception with message";
|
||||
break;
|
||||
default:
|
||||
messageLabel = "due to unexpected exception with messages"_sr;
|
||||
messageLabel = "due to unexpected exception with messages";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case ResultWas::FatalErrorCondition:
|
||||
colour = Colour::Error;
|
||||
passOrFail = "FAILED"_sr;
|
||||
messageLabel = "due to a fatal error condition"_sr;
|
||||
passOrFail = "FAILED";
|
||||
messageLabel = "due to a fatal error condition";
|
||||
break;
|
||||
case ResultWas::DidntThrowException:
|
||||
colour = Colour::Error;
|
||||
passOrFail = "FAILED"_sr;
|
||||
messageLabel = "because no exception was thrown where one was expected"_sr;
|
||||
passOrFail = "FAILED";
|
||||
messageLabel = "because no exception was thrown where one was expected";
|
||||
break;
|
||||
case ResultWas::Info:
|
||||
messageLabel = "info"_sr;
|
||||
messageLabel = "info";
|
||||
break;
|
||||
case ResultWas::Warning:
|
||||
messageLabel = "warning"_sr;
|
||||
messageLabel = "warning";
|
||||
break;
|
||||
case ResultWas::ExplicitFailure:
|
||||
passOrFail = "FAILED"_sr;
|
||||
passOrFail = "FAILED";
|
||||
colour = Colour::Error;
|
||||
if (messages.size() == 1)
|
||||
messageLabel = "explicitly with message"_sr;
|
||||
messageLabel = "explicitly with message";
|
||||
if (messages.size() > 1)
|
||||
messageLabel = "explicitly with messages"_sr;
|
||||
messageLabel = "explicitly with messages";
|
||||
break;
|
||||
case ResultWas::ExplicitSkip:
|
||||
colour = Colour::Skip;
|
||||
passOrFail = "SKIPPED"_sr;
|
||||
passOrFail = "SKIPPED";
|
||||
if (messages.size() == 1)
|
||||
messageLabel = "explicitly with message"_sr;
|
||||
messageLabel = "explicitly with message";
|
||||
if (messages.size() > 1)
|
||||
messageLabel = "explicitly with messages"_sr;
|
||||
messageLabel = "explicitly with messages";
|
||||
break;
|
||||
// These cases are here to prevent compiler warnings
|
||||
case ResultWas::Unknown:
|
||||
case ResultWas::FailureBit:
|
||||
case ResultWas::Exception:
|
||||
passOrFail = "** internal error **"_sr;
|
||||
passOrFail = "** internal error **";
|
||||
colour = Colour::Error;
|
||||
break;
|
||||
}
|
||||
@@ -185,8 +185,8 @@ private:
|
||||
AssertionStats const& stats;
|
||||
AssertionResult const& result;
|
||||
Colour::Code colour;
|
||||
StringRef passOrFail;
|
||||
StringRef messageLabel;
|
||||
std::string_view passOrFail;
|
||||
std::string_view messageLabel;
|
||||
std::vector<MessageInfo> const& messages;
|
||||
ColourImpl* colourImpl;
|
||||
bool printInfoMessages;
|
||||
@@ -263,20 +263,20 @@ public:
|
||||
return m_inNanoseconds;
|
||||
}
|
||||
}
|
||||
StringRef unitsAsString() const {
|
||||
std::string_view unitsAsString() const {
|
||||
switch (m_units) {
|
||||
case Unit::Nanoseconds:
|
||||
return "ns"_sr;
|
||||
return "ns";
|
||||
case Unit::Microseconds:
|
||||
return "us"_sr;
|
||||
return "us";
|
||||
case Unit::Milliseconds:
|
||||
return "ms"_sr;
|
||||
return "ms";
|
||||
case Unit::Seconds:
|
||||
return "s"_sr;
|
||||
return "s";
|
||||
case Unit::Minutes:
|
||||
return "m"_sr;
|
||||
return "m";
|
||||
default:
|
||||
return "** internal error **"_sr;
|
||||
return "** internal error **";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -411,11 +411,11 @@ std::string ConsoleReporter::getDescription() {
|
||||
return "Reports test results as plain lines of text";
|
||||
}
|
||||
|
||||
void ConsoleReporter::noMatchingTestCases( StringRef unmatchedSpec ) {
|
||||
void ConsoleReporter::noMatchingTestCases( std::string_view unmatchedSpec ) {
|
||||
m_stream << "No test cases matched '" << unmatchedSpec << "'\n";
|
||||
}
|
||||
|
||||
void ConsoleReporter::reportInvalidTestSpec( StringRef arg ) {
|
||||
void ConsoleReporter::reportInvalidTestSpec( std::string_view arg ) {
|
||||
m_stream << "Invalid Filter: " << arg << '\n';
|
||||
}
|
||||
|
||||
@@ -463,7 +463,7 @@ void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {
|
||||
StreamingReporterBase::sectionEnded(_sectionStats);
|
||||
}
|
||||
|
||||
void ConsoleReporter::benchmarkPreparing( StringRef name ) {
|
||||
void ConsoleReporter::benchmarkPreparing( std::string_view name ) {
|
||||
lazyPrintWithoutClosingBenchmarkTable();
|
||||
|
||||
auto nameCol = TextFlow::Column( static_cast<std::string>( name ) )
|
||||
@@ -506,7 +506,7 @@ void ConsoleReporter::benchmarkEnded(BenchmarkStats<> const& stats) {
|
||||
}
|
||||
}
|
||||
|
||||
void ConsoleReporter::benchmarkFailed( StringRef error ) {
|
||||
void ConsoleReporter::benchmarkFailed( std::string_view error ) {
|
||||
auto guard = m_colour->guardColour( Colour::Red ).engage( m_stream );
|
||||
(*m_tablePrinter)
|
||||
<< "Benchmark failed (" << error << ')'
|
||||
|
@@ -23,18 +23,18 @@ namespace Catch {
|
||||
~ConsoleReporter() override;
|
||||
static std::string getDescription();
|
||||
|
||||
void noMatchingTestCases( StringRef unmatchedSpec ) override;
|
||||
void reportInvalidTestSpec( StringRef arg ) override;
|
||||
void noMatchingTestCases( std::string_view unmatchedSpec ) override;
|
||||
void reportInvalidTestSpec( std::string_view arg ) override;
|
||||
|
||||
void assertionEnded(AssertionStats const& _assertionStats) override;
|
||||
|
||||
void sectionStarting(SectionInfo const& _sectionInfo) override;
|
||||
void sectionEnded(SectionStats const& _sectionStats) override;
|
||||
|
||||
void benchmarkPreparing( StringRef name ) override;
|
||||
void benchmarkPreparing( std::string_view name ) override;
|
||||
void benchmarkStarting(BenchmarkInfo const& info) override;
|
||||
void benchmarkEnded(BenchmarkStats<> const& stats) override;
|
||||
void benchmarkFailed( StringRef error ) override;
|
||||
void benchmarkFailed( std::string_view error ) override;
|
||||
|
||||
void testCaseEnded(TestCaseStats const& _testCaseStats) override;
|
||||
void testRunEnded(TestRunStats const& _testRunStats) override;
|
||||
|
@@ -96,14 +96,14 @@ namespace Catch {
|
||||
{}
|
||||
~CumulativeReporterBase() override;
|
||||
|
||||
void benchmarkPreparing( StringRef ) override {}
|
||||
void benchmarkPreparing( std::string_view ) override {}
|
||||
void benchmarkStarting( BenchmarkInfo const& ) override {}
|
||||
void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;
|
||||
void benchmarkFailed( StringRef ) override {}
|
||||
void benchmarkFailed( std::string_view ) override {}
|
||||
|
||||
void noMatchingTestCases( StringRef ) override {}
|
||||
void reportInvalidTestSpec( StringRef ) override {}
|
||||
void fatalErrorEncountered( StringRef /*error*/ ) override {}
|
||||
void noMatchingTestCases( std::string_view ) override {}
|
||||
void reportInvalidTestSpec( std::string_view ) override {}
|
||||
void fatalErrorEncountered( std::string_view /*error*/ ) override {}
|
||||
|
||||
void testRunStarting( TestRunInfo const& ) override {}
|
||||
|
||||
|
@@ -10,12 +10,12 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
void EventListenerBase::fatalErrorEncountered( StringRef ) {}
|
||||
void EventListenerBase::fatalErrorEncountered( std::string_view ) {}
|
||||
|
||||
void EventListenerBase::benchmarkPreparing( StringRef ) {}
|
||||
void EventListenerBase::benchmarkPreparing( std::string_view ) {}
|
||||
void EventListenerBase::benchmarkStarting( BenchmarkInfo const& ) {}
|
||||
void EventListenerBase::benchmarkEnded( BenchmarkStats<> const& ) {}
|
||||
void EventListenerBase::benchmarkFailed( StringRef ) {}
|
||||
void EventListenerBase::benchmarkFailed( std::string_view ) {}
|
||||
|
||||
void EventListenerBase::assertionStarting( AssertionInfo const& ) {}
|
||||
|
||||
@@ -26,8 +26,8 @@ namespace Catch {
|
||||
std::vector<ListenerDescription> const& ) {}
|
||||
void EventListenerBase::listTests( std::vector<TestCaseHandle> const& ) {}
|
||||
void EventListenerBase::listTags( std::vector<TagInfo> const& ) {}
|
||||
void EventListenerBase::noMatchingTestCases( StringRef ) {}
|
||||
void EventListenerBase::reportInvalidTestSpec( StringRef ) {}
|
||||
void EventListenerBase::noMatchingTestCases( std::string_view ) {}
|
||||
void EventListenerBase::reportInvalidTestSpec( std::string_view ) {}
|
||||
void EventListenerBase::testRunStarting( TestRunInfo const& ) {}
|
||||
void EventListenerBase::testCaseStarting( TestCaseInfo const& ) {}
|
||||
void EventListenerBase::testCasePartialStarting(TestCaseInfo const&, uint64_t) {}
|
||||
|
@@ -23,13 +23,13 @@ namespace Catch {
|
||||
public:
|
||||
using IEventListener::IEventListener;
|
||||
|
||||
void reportInvalidTestSpec( StringRef unmatchedSpec ) override;
|
||||
void fatalErrorEncountered( StringRef error ) override;
|
||||
void reportInvalidTestSpec( std::string_view unmatchedSpec ) override;
|
||||
void fatalErrorEncountered( std::string_view error ) override;
|
||||
|
||||
void benchmarkPreparing( StringRef name ) override;
|
||||
void benchmarkPreparing( std::string_view name ) override;
|
||||
void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
|
||||
void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;
|
||||
void benchmarkFailed( StringRef error ) override;
|
||||
void benchmarkFailed( std::string_view error ) override;
|
||||
|
||||
void assertionStarting( AssertionInfo const& assertionInfo ) override;
|
||||
void assertionEnded( AssertionStats const& assertionStats ) override;
|
||||
@@ -41,7 +41,7 @@ namespace Catch {
|
||||
void listTests( std::vector<TestCaseHandle> const& tests ) override;
|
||||
void listTags( std::vector<TagInfo> const& tagInfos ) override;
|
||||
|
||||
void noMatchingTestCases( StringRef unmatchedSpec ) override;
|
||||
void noMatchingTestCases( std::string_view unmatchedSpec ) override;
|
||||
void testRunStarting( TestRunInfo const& testRunInfo ) override;
|
||||
void testCaseStarting( TestCaseInfo const& testInfo ) override;
|
||||
void testCasePartialStarting( TestCaseInfo const& testInfo,
|
||||
|
@@ -213,7 +213,7 @@ namespace Catch {
|
||||
.width( CATCH_CONFIG_CONSOLE_WIDTH - 10 );
|
||||
out << str << wrapper << '\n';
|
||||
}
|
||||
out << pluralise(tags.size(), "tag"_sr) << "\n\n" << std::flush;
|
||||
out << pluralise(tags.size(), "tag") << "\n\n" << std::flush;
|
||||
}
|
||||
|
||||
void defaultListTests(std::ostream& out, ColourImpl* streamColour, std::vector<TestCaseHandle> const& tests, bool isFiltered, Verbosity verbosity) {
|
||||
@@ -249,9 +249,9 @@ namespace Catch {
|
||||
}
|
||||
|
||||
if (isFiltered) {
|
||||
out << pluralise(tests.size(), "matching test case"_sr);
|
||||
out << pluralise(tests.size(), "matching test case");
|
||||
} else {
|
||||
out << pluralise(tests.size(), "test case"_sr);
|
||||
out << pluralise(tests.size(), "test case");
|
||||
}
|
||||
out << "\n\n" << std::flush;
|
||||
}
|
||||
@@ -292,7 +292,7 @@ namespace Catch {
|
||||
|
||||
void printSummaryRow( std::ostream& stream,
|
||||
ColourImpl& colour,
|
||||
StringRef label,
|
||||
std::string_view label,
|
||||
std::vector<SummaryColumn> const& cols,
|
||||
std::size_t row ) {
|
||||
for ( auto const& col : cols ) {
|
||||
@@ -329,9 +329,9 @@ namespace Catch {
|
||||
stream << streamColour.guardColour( Colour::ResultSuccess )
|
||||
<< "All tests passed";
|
||||
stream << " ("
|
||||
<< pluralise( totals.assertions.passed, "assertion"_sr )
|
||||
<< pluralise( totals.assertions.passed, "assertion" )
|
||||
<< " in "
|
||||
<< pluralise( totals.testCases.passed, "test case"_sr )
|
||||
<< pluralise( totals.testCases.passed, "test case" )
|
||||
<< ')' << '\n';
|
||||
return;
|
||||
}
|
||||
@@ -357,8 +357,8 @@ namespace Catch {
|
||||
SummaryColumn( "failed as expected", Colour::ResultExpectedFailure )
|
||||
.addRow( totals.testCases.failedButOk )
|
||||
.addRow( totals.assertions.failedButOk ) );
|
||||
printSummaryRow( stream, streamColour, "test cases"_sr, columns, 0 );
|
||||
printSummaryRow( stream, streamColour, "assertions"_sr, columns, 1 );
|
||||
printSummaryRow( stream, streamColour, "test cases", columns, 0 );
|
||||
printSummaryRow( stream, streamColour, "assertions", columns, 1 );
|
||||
}
|
||||
|
||||
} // namespace Catch
|
||||
|
@@ -19,10 +19,10 @@ namespace Catch {
|
||||
void writeSourceInfo( JsonObjectWriter& writer,
|
||||
SourceLineInfo const& sourceInfo ) {
|
||||
auto source_location_writer =
|
||||
writer.write( "source-location"_sr ).writeObject();
|
||||
source_location_writer.write( "filename"_sr )
|
||||
writer.write( "source-location" ).writeObject();
|
||||
source_location_writer.write( "filename" )
|
||||
.write( sourceInfo.file );
|
||||
source_location_writer.write( "line"_sr ).write( sourceInfo.line );
|
||||
source_location_writer.write( "line" ).write( sourceInfo.line );
|
||||
}
|
||||
|
||||
void writeTags( JsonArrayWriter writer, std::vector<Tag> const& tags ) {
|
||||
@@ -33,12 +33,12 @@ namespace Catch {
|
||||
|
||||
void writeProperties( JsonArrayWriter writer,
|
||||
TestCaseInfo const& info ) {
|
||||
if ( info.isHidden() ) { writer.write( "is-hidden"_sr ); }
|
||||
if ( info.okToFail() ) { writer.write( "ok-to-fail"_sr ); }
|
||||
if ( info.isHidden() ) { writer.write( "is-hidden" ); }
|
||||
if ( info.okToFail() ) { writer.write( "ok-to-fail" ); }
|
||||
if ( info.expectedToFail() ) {
|
||||
writer.write( "expected-to-fail"_sr );
|
||||
writer.write( "expected-to-fail" );
|
||||
}
|
||||
if ( info.throws() ) { writer.write( "throws"_sr ); }
|
||||
if ( info.throws() ) { writer.write( "throws" ); }
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -58,16 +58,16 @@ namespace Catch {
|
||||
m_writers.emplace( Writer::Object );
|
||||
auto& writer = m_objectWriters.top();
|
||||
|
||||
writer.write( "version"_sr ).write( 1 );
|
||||
writer.write( "version" ).write( 1 );
|
||||
|
||||
{
|
||||
auto metadata_writer = writer.write( "metadata"_sr ).writeObject();
|
||||
metadata_writer.write( "name"_sr ).write( m_config->name() );
|
||||
metadata_writer.write( "rng-seed"_sr ).write( m_config->rngSeed() );
|
||||
metadata_writer.write( "catch2-version"_sr )
|
||||
auto metadata_writer = writer.write( "metadata" ).writeObject();
|
||||
metadata_writer.write( "name" ).write( m_config->name() );
|
||||
metadata_writer.write( "rng-seed" ).write( m_config->rngSeed() );
|
||||
metadata_writer.write( "catch2-version" )
|
||||
.write( libraryVersion() );
|
||||
if ( m_config->testSpec().hasFilters() ) {
|
||||
metadata_writer.write( "filters"_sr )
|
||||
metadata_writer.write( "filters" )
|
||||
.write( m_config->testSpec() );
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ namespace Catch {
|
||||
m_writers.emplace( Writer::Array );
|
||||
return m_arrayWriters.top();
|
||||
}
|
||||
JsonArrayWriter& JsonReporter::startArray( StringRef key ) {
|
||||
JsonArrayWriter& JsonReporter::startArray( std::string_view key ) {
|
||||
m_arrayWriters.emplace(
|
||||
m_objectWriters.top().write( key ).writeArray() );
|
||||
m_writers.emplace( Writer::Array );
|
||||
@@ -100,7 +100,7 @@ namespace Catch {
|
||||
m_writers.emplace( Writer::Object );
|
||||
return m_objectWriters.top();
|
||||
}
|
||||
JsonObjectWriter& JsonReporter::startObject( StringRef key ) {
|
||||
JsonObjectWriter& JsonReporter::startObject( std::string_view key ) {
|
||||
m_objectWriters.emplace(
|
||||
m_objectWriters.top().write( key ).writeObject() );
|
||||
m_writers.emplace( Writer::Object );
|
||||
@@ -123,7 +123,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
void JsonReporter::startListing() {
|
||||
if ( !m_startedListing ) { startObject( "listings"_sr ); }
|
||||
if ( !m_startedListing ) { startObject( "listings" ); }
|
||||
m_startedListing = true;
|
||||
}
|
||||
void JsonReporter::endListing() {
|
||||
@@ -140,15 +140,15 @@ namespace Catch {
|
||||
endListing();
|
||||
|
||||
assert( isInside( Writer::Object ) );
|
||||
startObject( "test-run"_sr );
|
||||
startArray( "test-cases"_sr );
|
||||
startObject( "test-run" );
|
||||
startArray( "test-cases" );
|
||||
}
|
||||
|
||||
static void writeCounts( JsonObjectWriter&& writer, Counts const& counts ) {
|
||||
writer.write( "passed"_sr ).write( counts.passed );
|
||||
writer.write( "failed"_sr ).write( counts.failed );
|
||||
writer.write( "fail-but-ok"_sr ).write( counts.failedButOk );
|
||||
writer.write( "skipped"_sr ).write( counts.skipped );
|
||||
writer.write( "passed" ).write( counts.passed );
|
||||
writer.write( "failed" ).write( counts.failed );
|
||||
writer.write( "fail-but-ok" ).write( counts.failedButOk );
|
||||
writer.write( "skipped" ).write( counts.skipped );
|
||||
}
|
||||
|
||||
void JsonReporter::testRunEnded(TestRunStats const& runStats) {
|
||||
@@ -158,10 +158,10 @@ namespace Catch {
|
||||
|
||||
{
|
||||
auto totals =
|
||||
m_objectWriters.top().write( "totals"_sr ).writeObject();
|
||||
writeCounts( totals.write( "assertions"_sr ).writeObject(),
|
||||
m_objectWriters.top().write( "totals" ).writeObject();
|
||||
writeCounts( totals.write( "assertions" ).writeObject(),
|
||||
runStats.totals.assertions );
|
||||
writeCounts( totals.write( "test-cases"_sr ).writeObject(),
|
||||
writeCounts( totals.write( "test-cases" ).writeObject(),
|
||||
runStats.totals.testCases );
|
||||
}
|
||||
|
||||
@@ -178,18 +178,18 @@ namespace Catch {
|
||||
// "test-info" prelude
|
||||
{
|
||||
auto testInfo =
|
||||
m_objectWriters.top().write( "test-info"_sr ).writeObject();
|
||||
m_objectWriters.top().write( "test-info" ).writeObject();
|
||||
// TODO: handle testName vs className!!
|
||||
testInfo.write( "name"_sr ).write( tcInfo.name );
|
||||
testInfo.write( "name" ).write( tcInfo.name );
|
||||
writeSourceInfo(testInfo, tcInfo.lineInfo);
|
||||
writeTags( testInfo.write( "tags"_sr ).writeArray(), tcInfo.tags );
|
||||
writeProperties( testInfo.write( "properties"_sr ).writeArray(),
|
||||
writeTags( testInfo.write( "tags" ).writeArray(), tcInfo.tags );
|
||||
writeProperties( testInfo.write( "properties" ).writeArray(),
|
||||
tcInfo );
|
||||
}
|
||||
|
||||
|
||||
// Start the array for individual test runs (testCasePartial pairs)
|
||||
startArray( "runs"_sr );
|
||||
startArray( "runs" );
|
||||
}
|
||||
|
||||
void JsonReporter::testCaseEnded( TestCaseStats const& tcStats ) {
|
||||
@@ -201,8 +201,8 @@ namespace Catch {
|
||||
|
||||
{
|
||||
auto totals =
|
||||
m_objectWriters.top().write( "totals"_sr ).writeObject();
|
||||
writeCounts( totals.write( "assertions"_sr ).writeObject(),
|
||||
m_objectWriters.top().write( "totals" ).writeObject();
|
||||
writeCounts( totals.write( "assertions" ).writeObject(),
|
||||
tcStats.totals.assertions );
|
||||
// We do not write the test case totals, because there will always be just one test case here.
|
||||
// TODO: overall "result" -> success, skip, fail here? Or in partial result?
|
||||
@@ -219,8 +219,8 @@ namespace Catch {
|
||||
void JsonReporter::testCasePartialStarting( TestCaseInfo const& /*tcInfo*/,
|
||||
uint64_t index ) {
|
||||
startObject();
|
||||
m_objectWriters.top().write( "run-idx"_sr ).write( index );
|
||||
startArray( "path"_sr );
|
||||
m_objectWriters.top().write( "run-idx" ).write( index );
|
||||
startArray( "path" );
|
||||
// TODO: we want to delay most of the printing to the 'root' section
|
||||
// TODO: childSection key name?
|
||||
}
|
||||
@@ -232,18 +232,18 @@ namespace Catch {
|
||||
endArray();
|
||||
if ( !tcStats.stdOut.empty() ) {
|
||||
m_objectWriters.top()
|
||||
.write( "captured-stdout"_sr )
|
||||
.write( "captured-stdout" )
|
||||
.write( tcStats.stdOut );
|
||||
}
|
||||
if ( !tcStats.stdErr.empty() ) {
|
||||
m_objectWriters.top()
|
||||
.write( "captured-stderr"_sr )
|
||||
.write( "captured-stderr" )
|
||||
.write( tcStats.stdErr );
|
||||
}
|
||||
{
|
||||
auto totals =
|
||||
m_objectWriters.top().write( "totals"_sr ).writeObject();
|
||||
writeCounts( totals.write( "assertions"_sr ).writeObject(),
|
||||
m_objectWriters.top().write( "totals" ).writeObject();
|
||||
writeCounts( totals.write( "assertions" ).writeObject(),
|
||||
tcStats.totals.assertions );
|
||||
// We do not write the test case totals, because there will
|
||||
// always be just one test case here.
|
||||
@@ -261,8 +261,8 @@ namespace Catch {
|
||||
// We want to nest top level sections, even though it shares name
|
||||
// and source loc with the TEST_CASE
|
||||
auto& sectionObject = startObject();
|
||||
sectionObject.write( "kind"_sr ).write( "section"_sr );
|
||||
sectionObject.write( "name"_sr ).write( sectionInfo.name );
|
||||
sectionObject.write( "kind" ).write( "section" );
|
||||
sectionObject.write( "name" ).write( sectionInfo.name );
|
||||
writeSourceInfo( m_objectWriters.top(), sectionInfo.lineInfo );
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace Catch {
|
||||
// rather complex, but we could do it, and it would look
|
||||
// better for empty sections. OTOH, empty sections should
|
||||
// be rare.
|
||||
startArray( "path"_sr );
|
||||
startArray( "path" );
|
||||
}
|
||||
void JsonReporter::sectionEnded( SectionStats const& /*sectionStats */) {
|
||||
// End the subpath array
|
||||
@@ -293,10 +293,10 @@ namespace Catch {
|
||||
assert( isInside( Writer::Array ) );
|
||||
auto assertionObject = m_arrayWriters.top().writeObject();
|
||||
|
||||
assertionObject.write( "kind"_sr ).write( "assertion"_sr );
|
||||
assertionObject.write( "kind" ).write( "assertion" );
|
||||
writeSourceInfo( assertionObject,
|
||||
assertionStats.assertionResult.getSourceInfo() );
|
||||
assertionObject.write( "status"_sr )
|
||||
assertionObject.write( "status" )
|
||||
.write( assertionStats.assertionResult.isOk() );
|
||||
// TODO: handling of result.
|
||||
// TODO: messages
|
||||
@@ -304,21 +304,21 @@ namespace Catch {
|
||||
}
|
||||
|
||||
|
||||
void JsonReporter::benchmarkPreparing( StringRef name ) { (void)name; }
|
||||
void JsonReporter::benchmarkPreparing( std::string_view name ) { (void)name; }
|
||||
void JsonReporter::benchmarkStarting( BenchmarkInfo const& ) {}
|
||||
void JsonReporter::benchmarkEnded( BenchmarkStats<> const& ) {}
|
||||
void JsonReporter::benchmarkFailed( StringRef error ) { (void)error; }
|
||||
void JsonReporter::benchmarkFailed( std::string_view error ) { (void)error; }
|
||||
|
||||
void JsonReporter::listReporters(
|
||||
std::vector<ReporterDescription> const& descriptions ) {
|
||||
startListing();
|
||||
|
||||
auto writer =
|
||||
m_objectWriters.top().write( "reporters"_sr ).writeArray();
|
||||
m_objectWriters.top().write( "reporters" ).writeArray();
|
||||
for ( auto const& desc : descriptions ) {
|
||||
auto desc_writer = writer.writeObject();
|
||||
desc_writer.write( "name"_sr ).write( desc.name );
|
||||
desc_writer.write( "description"_sr ).write( desc.description );
|
||||
desc_writer.write( "name" ).write( desc.name );
|
||||
desc_writer.write( "description" ).write( desc.description );
|
||||
}
|
||||
}
|
||||
void JsonReporter::listListeners(
|
||||
@@ -326,27 +326,27 @@ namespace Catch {
|
||||
startListing();
|
||||
|
||||
auto writer =
|
||||
m_objectWriters.top().write( "listeners"_sr ).writeArray();
|
||||
m_objectWriters.top().write( "listeners" ).writeArray();
|
||||
|
||||
for ( auto const& desc : descriptions ) {
|
||||
auto desc_writer = writer.writeObject();
|
||||
desc_writer.write( "name"_sr ).write( desc.name );
|
||||
desc_writer.write( "description"_sr ).write( desc.description );
|
||||
desc_writer.write( "name" ).write( desc.name );
|
||||
desc_writer.write( "description" ).write( desc.description );
|
||||
}
|
||||
}
|
||||
void JsonReporter::listTests( std::vector<TestCaseHandle> const& tests ) {
|
||||
startListing();
|
||||
|
||||
auto writer = m_objectWriters.top().write( "tests"_sr ).writeArray();
|
||||
auto writer = m_objectWriters.top().write( "tests" ).writeArray();
|
||||
|
||||
for ( auto const& test : tests ) {
|
||||
auto desc_writer = writer.writeObject();
|
||||
auto const& info = test.getTestCaseInfo();
|
||||
|
||||
desc_writer.write( "name"_sr ).write( info.name );
|
||||
desc_writer.write( "class-name"_sr ).write( info.className );
|
||||
desc_writer.write( "name" ).write( info.name );
|
||||
desc_writer.write( "class-name" ).write( info.className );
|
||||
{
|
||||
auto tag_writer = desc_writer.write( "tags"_sr ).writeArray();
|
||||
auto tag_writer = desc_writer.write( "tags" ).writeArray();
|
||||
for ( auto const& tag : info.tags ) {
|
||||
tag_writer.write( tag.original );
|
||||
}
|
||||
@@ -357,17 +357,17 @@ namespace Catch {
|
||||
void JsonReporter::listTags( std::vector<TagInfo> const& tags ) {
|
||||
startListing();
|
||||
|
||||
auto writer = m_objectWriters.top().write( "tags"_sr ).writeArray();
|
||||
auto writer = m_objectWriters.top().write( "tags" ).writeArray();
|
||||
for ( auto const& tag : tags ) {
|
||||
auto tag_writer = writer.writeObject();
|
||||
{
|
||||
auto aliases_writer =
|
||||
tag_writer.write( "aliases"_sr ).writeArray();
|
||||
tag_writer.write( "aliases" ).writeArray();
|
||||
for ( auto alias : tag.spellings ) {
|
||||
aliases_writer.write( alias );
|
||||
}
|
||||
}
|
||||
tag_writer.write( "count"_sr ).write( tag.count );
|
||||
tag_writer.write( "count" ).write( tag.count );
|
||||
}
|
||||
}
|
||||
} // namespace Catch
|
||||
|
@@ -43,10 +43,10 @@ namespace Catch {
|
||||
|
||||
//void testRunEndedCumulative() override;
|
||||
|
||||
void benchmarkPreparing( StringRef name ) override;
|
||||
void benchmarkPreparing( std::string_view name ) override;
|
||||
void benchmarkStarting( BenchmarkInfo const& ) override;
|
||||
void benchmarkEnded( BenchmarkStats<> const& ) override;
|
||||
void benchmarkFailed( StringRef error ) override;
|
||||
void benchmarkFailed( std::string_view error ) override;
|
||||
|
||||
void listReporters(
|
||||
std::vector<ReporterDescription> const& descriptions ) override;
|
||||
@@ -63,10 +63,10 @@ namespace Catch {
|
||||
};
|
||||
|
||||
JsonArrayWriter& startArray();
|
||||
JsonArrayWriter& startArray( StringRef key );
|
||||
JsonArrayWriter& startArray( std::string_view key );
|
||||
|
||||
JsonObjectWriter& startObject();
|
||||
JsonObjectWriter& startObject( StringRef key );
|
||||
JsonObjectWriter& startObject( std::string_view key );
|
||||
|
||||
void endObject();
|
||||
void endArray();
|
||||
|
@@ -132,28 +132,28 @@ namespace Catch {
|
||||
XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" );
|
||||
|
||||
TestRunStats const& stats = testRunNode.value;
|
||||
xml.writeAttribute( "name"_sr, stats.runInfo.name );
|
||||
xml.writeAttribute( "errors"_sr, unexpectedExceptions );
|
||||
xml.writeAttribute( "failures"_sr, stats.totals.assertions.failed-unexpectedExceptions );
|
||||
xml.writeAttribute( "skipped"_sr, stats.totals.assertions.skipped );
|
||||
xml.writeAttribute( "tests"_sr, stats.totals.assertions.total() );
|
||||
xml.writeAttribute( "hostname"_sr, "tbd"_sr ); // !TBD
|
||||
xml.writeAttribute( "name", stats.runInfo.name );
|
||||
xml.writeAttribute( "errors", unexpectedExceptions );
|
||||
xml.writeAttribute( "failures", stats.totals.assertions.failed-unexpectedExceptions );
|
||||
xml.writeAttribute( "skipped", stats.totals.assertions.skipped );
|
||||
xml.writeAttribute( "tests", stats.totals.assertions.total() );
|
||||
xml.writeAttribute( "hostname", "tbd" ); // !TBD
|
||||
if( m_config->showDurations() == ShowDurations::Never )
|
||||
xml.writeAttribute( "time"_sr, ""_sr );
|
||||
xml.writeAttribute( "time", "" );
|
||||
else
|
||||
xml.writeAttribute( "time"_sr, formatDuration( suiteTime ) );
|
||||
xml.writeAttribute( "timestamp"_sr, getCurrentTimestamp() );
|
||||
xml.writeAttribute( "time", formatDuration( suiteTime ) );
|
||||
xml.writeAttribute( "timestamp", getCurrentTimestamp() );
|
||||
|
||||
// Write properties
|
||||
{
|
||||
auto properties = xml.scopedElement("properties");
|
||||
xml.scopedElement("property")
|
||||
.writeAttribute("name"_sr, "random-seed"_sr)
|
||||
.writeAttribute("value"_sr, m_config->rngSeed());
|
||||
.writeAttribute("name", "random-seed")
|
||||
.writeAttribute("value", m_config->rngSeed());
|
||||
if (m_config->testSpec().hasFilters()) {
|
||||
xml.scopedElement("property")
|
||||
.writeAttribute("name"_sr, "filters"_sr)
|
||||
.writeAttribute("value"_sr, m_config->testSpec());
|
||||
.writeAttribute("name", "filters")
|
||||
.writeAttribute("value", m_config->testSpec());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,19 +204,19 @@ namespace Catch {
|
||||
|| !sectionNode.stdErr.empty() ) {
|
||||
XmlWriter::ScopedElement e = xml.scopedElement( "testcase" );
|
||||
if( className.empty() ) {
|
||||
xml.writeAttribute( "classname"_sr, name );
|
||||
xml.writeAttribute( "name"_sr, "root"_sr );
|
||||
xml.writeAttribute( "classname", name );
|
||||
xml.writeAttribute( "name", "root" );
|
||||
}
|
||||
else {
|
||||
xml.writeAttribute( "classname"_sr, className );
|
||||
xml.writeAttribute( "name"_sr, name );
|
||||
xml.writeAttribute( "classname", className );
|
||||
xml.writeAttribute( "name", name );
|
||||
}
|
||||
xml.writeAttribute( "time"_sr, formatDuration( sectionNode.stats.durationInSeconds ) );
|
||||
xml.writeAttribute( "time", formatDuration( sectionNode.stats.durationInSeconds ) );
|
||||
// This is not ideal, but it should be enough to mimic gtest's
|
||||
// junit output.
|
||||
// Ideally the JUnit reporter would also handle `skipTest`
|
||||
// events and write those out appropriately.
|
||||
xml.writeAttribute( "status"_sr, "run"_sr );
|
||||
xml.writeAttribute( "status", "run" );
|
||||
|
||||
if (sectionNode.stats.assertions.failedButOk) {
|
||||
xml.scopedElement("skipped")
|
||||
@@ -277,8 +277,8 @@ namespace Catch {
|
||||
|
||||
XmlWriter::ScopedElement e = xml.scopedElement( elementName );
|
||||
|
||||
xml.writeAttribute( "message"_sr, result.getExpression() );
|
||||
xml.writeAttribute( "type"_sr, result.getTestMacroName() );
|
||||
xml.writeAttribute( "message", result.getExpression() );
|
||||
xml.writeAttribute( "type", result.getTestMacroName() );
|
||||
|
||||
ReusableStringStream rss;
|
||||
if ( result.getResultType() == ResultWas::ExplicitSkip ) {
|
||||
|
@@ -44,25 +44,25 @@ namespace Catch {
|
||||
m_reporterLikes.push_back( CATCH_MOVE( reporter ) );
|
||||
}
|
||||
|
||||
void MultiReporter::noMatchingTestCases( StringRef unmatchedSpec ) {
|
||||
void MultiReporter::noMatchingTestCases( std::string_view unmatchedSpec ) {
|
||||
for ( auto& reporterish : m_reporterLikes ) {
|
||||
reporterish->noMatchingTestCases( unmatchedSpec );
|
||||
}
|
||||
}
|
||||
|
||||
void MultiReporter::fatalErrorEncountered( StringRef error ) {
|
||||
void MultiReporter::fatalErrorEncountered( std::string_view error ) {
|
||||
for ( auto& reporterish : m_reporterLikes ) {
|
||||
reporterish->fatalErrorEncountered( error );
|
||||
}
|
||||
}
|
||||
|
||||
void MultiReporter::reportInvalidTestSpec( StringRef arg ) {
|
||||
void MultiReporter::reportInvalidTestSpec( std::string_view arg ) {
|
||||
for ( auto& reporterish : m_reporterLikes ) {
|
||||
reporterish->reportInvalidTestSpec( arg );
|
||||
}
|
||||
}
|
||||
|
||||
void MultiReporter::benchmarkPreparing( StringRef name ) {
|
||||
void MultiReporter::benchmarkPreparing( std::string_view name ) {
|
||||
for (auto& reporterish : m_reporterLikes) {
|
||||
reporterish->benchmarkPreparing(name);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
|
||||
void MultiReporter::benchmarkFailed( StringRef error ) {
|
||||
void MultiReporter::benchmarkFailed( std::string_view error ) {
|
||||
for (auto& reporterish : m_reporterLikes) {
|
||||
reporterish->benchmarkFailed(error);
|
||||
}
|
||||
|
@@ -41,14 +41,14 @@ namespace Catch {
|
||||
|
||||
public: // IEventListener
|
||||
|
||||
void noMatchingTestCases( StringRef unmatchedSpec ) override;
|
||||
void fatalErrorEncountered( StringRef error ) override;
|
||||
void reportInvalidTestSpec( StringRef arg ) override;
|
||||
void noMatchingTestCases( std::string_view unmatchedSpec ) override;
|
||||
void fatalErrorEncountered( std::string_view error ) override;
|
||||
void reportInvalidTestSpec( std::string_view arg ) override;
|
||||
|
||||
void benchmarkPreparing( StringRef name ) override;
|
||||
void benchmarkPreparing( std::string_view name ) override;
|
||||
void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;
|
||||
void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;
|
||||
void benchmarkFailed( StringRef error ) override;
|
||||
void benchmarkFailed( std::string_view error ) override;
|
||||
|
||||
void testRunStarting( TestRunInfo const& testRunInfo ) override;
|
||||
void testCaseStarting( TestCaseInfo const& testInfo ) override;
|
||||
|
@@ -67,7 +67,7 @@ namespace Catch {
|
||||
class ListenerRegistrar {
|
||||
|
||||
class TypedListenerFactory : public EventListenerFactory {
|
||||
StringRef m_listenerName;
|
||||
std::string_view m_listenerName;
|
||||
|
||||
std::string getDescriptionImpl( std::true_type ) const {
|
||||
return T::getDescription();
|
||||
@@ -78,14 +78,14 @@ namespace Catch {
|
||||
}
|
||||
|
||||
public:
|
||||
TypedListenerFactory( StringRef listenerName ):
|
||||
TypedListenerFactory( std::string_view listenerName ):
|
||||
m_listenerName( listenerName ) {}
|
||||
|
||||
IEventListenerPtr create( IConfig const* config ) const override {
|
||||
return Detail::make_unique<T>( config );
|
||||
}
|
||||
|
||||
StringRef getName() const override {
|
||||
std::string_view getName() const override {
|
||||
return m_listenerName;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Catch {
|
||||
};
|
||||
|
||||
public:
|
||||
ListenerRegistrar(StringRef listenerName) {
|
||||
ListenerRegistrar(std::string_view listenerName) {
|
||||
registerListenerImpl( Detail::make_unique<TypedListenerFactory>(listenerName) );
|
||||
}
|
||||
};
|
||||
@@ -119,7 +119,7 @@ namespace Catch {
|
||||
namespace { \
|
||||
const Catch::ListenerRegistrar<listenerType> \
|
||||
INTERNAL_CATCH_UNIQUE_NAME( catch_internal_RegistrarFor )( \
|
||||
#listenerType##_catch_sr ); \
|
||||
#listenerType ); \
|
||||
} \
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
|
||||
|
||||
|
@@ -36,11 +36,11 @@ namespace Catch {
|
||||
|
||||
xml.writeComment( createMetadataString( *m_config ) );
|
||||
xml.startElement("testExecutions");
|
||||
xml.writeAttribute("version"_sr, '1');
|
||||
xml.writeAttribute("version", '1');
|
||||
}
|
||||
|
||||
void SonarQubeReporter::writeRun( TestRunNode const& runNode ) {
|
||||
std::map<StringRef, std::vector<TestCaseNode const*>> testsPerFile;
|
||||
std::map<std::string_view, std::vector<TestCaseNode const*>> testsPerFile;
|
||||
|
||||
for ( auto const& child : runNode.children ) {
|
||||
testsPerFile[child->value.testInfo->lineInfo.file].push_back(
|
||||
@@ -52,9 +52,9 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
|
||||
void SonarQubeReporter::writeTestFile(StringRef filename, std::vector<TestCaseNode const*> const& testCaseNodes) {
|
||||
void SonarQubeReporter::writeTestFile(std::string_view filename, std::vector<TestCaseNode const*> const& testCaseNodes) {
|
||||
XmlWriter::ScopedElement e = xml.scopedElement("file");
|
||||
xml.writeAttribute("path"_sr, filename);
|
||||
xml.writeAttribute("path", filename);
|
||||
|
||||
for (auto const& child : testCaseNodes)
|
||||
writeTestCase(*child);
|
||||
@@ -77,8 +77,8 @@ namespace Catch {
|
||||
|| !sectionNode.stdOut.empty()
|
||||
|| !sectionNode.stdErr.empty() ) {
|
||||
XmlWriter::ScopedElement e = xml.scopedElement("testCase");
|
||||
xml.writeAttribute("name"_sr, name);
|
||||
xml.writeAttribute("duration"_sr, static_cast<long>(sectionNode.stats.durationInSeconds * 1000));
|
||||
xml.writeAttribute("name", name);
|
||||
xml.writeAttribute("duration", static_cast<long>(sectionNode.stats.durationInSeconds * 1000));
|
||||
|
||||
writeAssertions(sectionNode, okToFail);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ namespace Catch {
|
||||
|
||||
ReusableStringStream messageRss;
|
||||
messageRss << result.getTestMacroName() << '(' << result.getExpression() << ')';
|
||||
xml.writeAttribute("message"_sr, messageRss.str());
|
||||
xml.writeAttribute("message", messageRss.str());
|
||||
|
||||
ReusableStringStream textRss;
|
||||
if ( result.getResultType() == ResultWas::ExplicitSkip ) {
|
||||
|
@@ -40,7 +40,7 @@ namespace Catch {
|
||||
|
||||
void writeRun( TestRunNode const& runNode );
|
||||
|
||||
void writeTestFile(StringRef filename, std::vector<TestCaseNode const*> const& testCaseNodes);
|
||||
void writeTestFile(std::string_view filename, std::vector<TestCaseNode const*> const& testCaseNodes);
|
||||
|
||||
void writeTestCase(TestCaseNode const& testCaseNode);
|
||||
|
||||
|
@@ -24,14 +24,14 @@ namespace Catch {
|
||||
{}
|
||||
~StreamingReporterBase() override;
|
||||
|
||||
void benchmarkPreparing( StringRef ) override {}
|
||||
void benchmarkPreparing( std::string_view ) override {}
|
||||
void benchmarkStarting( BenchmarkInfo const& ) override {}
|
||||
void benchmarkEnded( BenchmarkStats<> const& ) override {}
|
||||
void benchmarkFailed( StringRef ) override {}
|
||||
void benchmarkFailed( std::string_view ) override {}
|
||||
|
||||
void fatalErrorEncountered( StringRef /*error*/ ) override {}
|
||||
void noMatchingTestCases( StringRef /*unmatchedSpec*/ ) override {}
|
||||
void reportInvalidTestSpec( StringRef /*invalidArgument*/ ) override {}
|
||||
void fatalErrorEncountered( std::string_view /*error*/ ) override {}
|
||||
void noMatchingTestCases( std::string_view /*unmatchedSpec*/ ) override {}
|
||||
void reportInvalidTestSpec( std::string_view /*invalidArgument*/ ) override {}
|
||||
|
||||
void testRunStarting( TestRunInfo const& _testRunInfo ) override;
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Catch {
|
||||
}
|
||||
|
||||
protected:
|
||||
TestRunInfo currentTestRunInfo{ "test run has not started yet"_sr };
|
||||
TestRunInfo currentTestRunInfo{ "test run has not started yet" };
|
||||
TestCaseInfo const* currentTestCaseInfo = nullptr;
|
||||
|
||||
//! Stack of all _active_ sections in the _current_ test case
|
||||
|
@@ -21,8 +21,8 @@ namespace Catch {
|
||||
namespace {
|
||||
// Yes, this has to be outside the class and namespaced by naming.
|
||||
// Making older compiler happy is hard.
|
||||
static constexpr StringRef tapFailedString = "not ok"_sr;
|
||||
static constexpr StringRef tapPassedString = "ok"_sr;
|
||||
static constexpr std::string_view tapFailedString = "not ok";
|
||||
static constexpr std::string_view tapPassedString = "ok";
|
||||
static constexpr Colour::Code tapDimColour = Colour::FileName;
|
||||
|
||||
class TapAssertionPrinter {
|
||||
@@ -66,42 +66,42 @@ namespace Catch {
|
||||
break;
|
||||
case ResultWas::ThrewException:
|
||||
printResultType(tapFailedString);
|
||||
printIssue("unexpected exception with message:"_sr);
|
||||
printIssue("unexpected exception with message:");
|
||||
printMessage();
|
||||
printExpressionWas();
|
||||
printRemainingMessages();
|
||||
break;
|
||||
case ResultWas::FatalErrorCondition:
|
||||
printResultType(tapFailedString);
|
||||
printIssue("fatal error condition with message:"_sr);
|
||||
printIssue("fatal error condition with message:");
|
||||
printMessage();
|
||||
printExpressionWas();
|
||||
printRemainingMessages();
|
||||
break;
|
||||
case ResultWas::DidntThrowException:
|
||||
printResultType(tapFailedString);
|
||||
printIssue("expected exception, got none"_sr);
|
||||
printIssue("expected exception, got none");
|
||||
printExpressionWas();
|
||||
printRemainingMessages();
|
||||
break;
|
||||
case ResultWas::Info:
|
||||
printResultType("info"_sr);
|
||||
printResultType("info");
|
||||
printMessage();
|
||||
printRemainingMessages();
|
||||
break;
|
||||
case ResultWas::Warning:
|
||||
printResultType("warning"_sr);
|
||||
printResultType("warning");
|
||||
printMessage();
|
||||
printRemainingMessages();
|
||||
break;
|
||||
case ResultWas::ExplicitFailure:
|
||||
printResultType(tapFailedString);
|
||||
printIssue("explicitly"_sr);
|
||||
printIssue("explicitly");
|
||||
printRemainingMessages(Colour::None);
|
||||
break;
|
||||
case ResultWas::ExplicitSkip:
|
||||
printResultType(tapPassedString);
|
||||
printIssue(" # SKIP"_sr);
|
||||
printIssue(" # SKIP");
|
||||
printMessage();
|
||||
printRemainingMessages();
|
||||
break;
|
||||
@@ -109,19 +109,19 @@ namespace Catch {
|
||||
case ResultWas::Unknown:
|
||||
case ResultWas::FailureBit:
|
||||
case ResultWas::Exception:
|
||||
printResultType("** internal error **"_sr);
|
||||
printResultType("** internal error **");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void printResultType(StringRef passOrFail) const {
|
||||
void printResultType(std::string_view passOrFail) const {
|
||||
if (!passOrFail.empty()) {
|
||||
stream << passOrFail << ' ' << counter << " -";
|
||||
}
|
||||
}
|
||||
|
||||
void printIssue(StringRef issue) const {
|
||||
void printIssue(std::string_view issue) const {
|
||||
stream << ' ' << issue;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace Catch {
|
||||
const std::size_t N = static_cast<std::size_t>(itEnd - itMessage);
|
||||
|
||||
stream << colourImpl->guardColour( colour ) << " with "
|
||||
<< pluralise( N, "message"_sr ) << ':';
|
||||
<< pluralise( N, "message" ) << ':';
|
||||
|
||||
for (; itMessage != itEnd; ) {
|
||||
// If this assertion is a warning ignore any INFO messages
|
||||
@@ -200,7 +200,7 @@ namespace Catch {
|
||||
<< std::flush;
|
||||
}
|
||||
|
||||
void TAPReporter::noMatchingTestCases( StringRef unmatchedSpec ) {
|
||||
void TAPReporter::noMatchingTestCases( std::string_view unmatchedSpec ) {
|
||||
m_stream << "# No test cases matched '" << unmatchedSpec << "'\n";
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,7 @@ namespace Catch {
|
||||
|
||||
void testRunStarting( TestRunInfo const& testInfo ) override;
|
||||
|
||||
void noMatchingTestCases( StringRef unmatchedSpec ) override;
|
||||
void noMatchingTestCases( std::string_view unmatchedSpec ) override;
|
||||
|
||||
void assertionEnded(AssertionStats const& _assertionStats) override;
|
||||
|
||||
|
@@ -32,7 +32,7 @@ namespace Catch {
|
||||
.initialIndent(indent) << '\n';
|
||||
}
|
||||
|
||||
std::string escape(StringRef str) {
|
||||
std::string escape(std::string_view str) {
|
||||
std::string escaped = static_cast<std::string>(str);
|
||||
replaceInPlace(escaped, "|", "||");
|
||||
replaceInPlace(escaped, "'", "|'");
|
||||
|
@@ -45,8 +45,8 @@ namespace Catch {
|
||||
|
||||
void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) {
|
||||
m_xml
|
||||
.writeAttribute( "filename"_sr, sourceInfo.file )
|
||||
.writeAttribute( "line"_sr, sourceInfo.line );
|
||||
.writeAttribute( "filename", sourceInfo.file )
|
||||
.writeAttribute( "line", sourceInfo.line );
|
||||
}
|
||||
|
||||
void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) {
|
||||
@@ -55,20 +55,20 @@ namespace Catch {
|
||||
if( !stylesheetRef.empty() )
|
||||
m_xml.writeStylesheetRef( stylesheetRef );
|
||||
m_xml.startElement("Catch2TestRun")
|
||||
.writeAttribute("name"_sr, m_config->name())
|
||||
.writeAttribute("rng-seed"_sr, m_config->rngSeed())
|
||||
.writeAttribute("xml-format-version"_sr, 3)
|
||||
.writeAttribute("catch2-version"_sr, libraryVersion());
|
||||
.writeAttribute("name", m_config->name())
|
||||
.writeAttribute("rng-seed", m_config->rngSeed())
|
||||
.writeAttribute("xml-format-version", 3)
|
||||
.writeAttribute("catch2-version", libraryVersion());
|
||||
if ( m_config->testSpec().hasFilters() ) {
|
||||
m_xml.writeAttribute( "filters"_sr, m_config->testSpec() );
|
||||
m_xml.writeAttribute( "filters", m_config->testSpec() );
|
||||
}
|
||||
}
|
||||
|
||||
void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) {
|
||||
StreamingReporterBase::testCaseStarting(testInfo);
|
||||
m_xml.startElement( "TestCase" )
|
||||
.writeAttribute( "name"_sr, trim( StringRef(testInfo.name) ) )
|
||||
.writeAttribute( "tags"_sr, testInfo.tagsAsString() );
|
||||
.writeAttribute( "name", trim( std::string_view(testInfo.name) ) )
|
||||
.writeAttribute( "tags", testInfo.tagsAsString() );
|
||||
|
||||
writeSourceInfo( testInfo.lineInfo );
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Catch {
|
||||
StreamingReporterBase::sectionStarting( sectionInfo );
|
||||
if( m_sectionDepth++ > 0 ) {
|
||||
m_xml.startElement( "Section" )
|
||||
.writeAttribute( "name"_sr, trim( StringRef(sectionInfo.name) ) );
|
||||
.writeAttribute( "name", trim( std::string_view(sectionInfo.name) ) );
|
||||
writeSourceInfo( sectionInfo.lineInfo );
|
||||
m_xml.ensureTagClosed();
|
||||
}
|
||||
@@ -117,8 +117,8 @@ namespace Catch {
|
||||
// Print the expression if there is one.
|
||||
if( result.hasExpression() ) {
|
||||
m_xml.startElement( "Expression" )
|
||||
.writeAttribute( "success"_sr, result.succeeded() )
|
||||
.writeAttribute( "type"_sr, result.getTestMacroName() );
|
||||
.writeAttribute( "success", result.succeeded() )
|
||||
.writeAttribute( "type", result.getTestMacroName() );
|
||||
|
||||
writeSourceInfo( result.getSourceInfo() );
|
||||
|
||||
@@ -174,13 +174,13 @@ namespace Catch {
|
||||
if ( --m_sectionDepth > 0 ) {
|
||||
{
|
||||
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" );
|
||||
e.writeAttribute( "successes"_sr, sectionStats.assertions.passed );
|
||||
e.writeAttribute( "failures"_sr, sectionStats.assertions.failed );
|
||||
e.writeAttribute( "expectedFailures"_sr, sectionStats.assertions.failedButOk );
|
||||
e.writeAttribute( "skipped"_sr, sectionStats.assertions.skipped > 0 );
|
||||
e.writeAttribute( "successes", sectionStats.assertions.passed );
|
||||
e.writeAttribute( "failures", sectionStats.assertions.failed );
|
||||
e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk );
|
||||
e.writeAttribute( "skipped", sectionStats.assertions.skipped > 0 );
|
||||
|
||||
if ( m_config->showDurations() == ShowDurations::Always )
|
||||
e.writeAttribute( "durationInSeconds"_sr, sectionStats.durationInSeconds );
|
||||
e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds );
|
||||
}
|
||||
// Ends assertion tag
|
||||
m_xml.endElement();
|
||||
@@ -190,15 +190,15 @@ namespace Catch {
|
||||
void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {
|
||||
StreamingReporterBase::testCaseEnded( testCaseStats );
|
||||
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" );
|
||||
e.writeAttribute( "success"_sr, testCaseStats.totals.assertions.allOk() );
|
||||
e.writeAttribute( "skips"_sr, testCaseStats.totals.assertions.skipped );
|
||||
e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() );
|
||||
e.writeAttribute( "skips", testCaseStats.totals.assertions.skipped );
|
||||
|
||||
if ( m_config->showDurations() == ShowDurations::Always )
|
||||
e.writeAttribute( "durationInSeconds"_sr, m_testCaseTimer.getElapsedSeconds() );
|
||||
e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() );
|
||||
if( !testCaseStats.stdOut.empty() )
|
||||
m_xml.scopedElement( "StdOut" ).writeText( trim( StringRef(testCaseStats.stdOut) ), XmlFormatting::Newline );
|
||||
m_xml.scopedElement( "StdOut" ).writeText( trim( std::string_view(testCaseStats.stdOut) ), XmlFormatting::Newline );
|
||||
if( !testCaseStats.stdErr.empty() )
|
||||
m_xml.scopedElement( "StdErr" ).writeText( trim( StringRef(testCaseStats.stdErr) ), XmlFormatting::Newline );
|
||||
m_xml.scopedElement( "StdErr" ).writeText( trim( std::string_view(testCaseStats.stdErr) ), XmlFormatting::Newline );
|
||||
|
||||
m_xml.endElement();
|
||||
}
|
||||
@@ -206,55 +206,55 @@ namespace Catch {
|
||||
void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) {
|
||||
StreamingReporterBase::testRunEnded( testRunStats );
|
||||
m_xml.scopedElement( "OverallResults" )
|
||||
.writeAttribute( "successes"_sr, testRunStats.totals.assertions.passed )
|
||||
.writeAttribute( "failures"_sr, testRunStats.totals.assertions.failed )
|
||||
.writeAttribute( "expectedFailures"_sr, testRunStats.totals.assertions.failedButOk )
|
||||
.writeAttribute( "skips"_sr, testRunStats.totals.assertions.skipped );
|
||||
.writeAttribute( "successes", testRunStats.totals.assertions.passed )
|
||||
.writeAttribute( "failures", testRunStats.totals.assertions.failed )
|
||||
.writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk )
|
||||
.writeAttribute( "skips", testRunStats.totals.assertions.skipped );
|
||||
m_xml.scopedElement( "OverallResultsCases")
|
||||
.writeAttribute( "successes"_sr, testRunStats.totals.testCases.passed )
|
||||
.writeAttribute( "failures"_sr, testRunStats.totals.testCases.failed )
|
||||
.writeAttribute( "expectedFailures"_sr, testRunStats.totals.testCases.failedButOk )
|
||||
.writeAttribute( "skips"_sr, testRunStats.totals.testCases.skipped );
|
||||
.writeAttribute( "successes", testRunStats.totals.testCases.passed )
|
||||
.writeAttribute( "failures", testRunStats.totals.testCases.failed )
|
||||
.writeAttribute( "expectedFailures", testRunStats.totals.testCases.failedButOk )
|
||||
.writeAttribute( "skips", testRunStats.totals.testCases.skipped );
|
||||
m_xml.endElement();
|
||||
}
|
||||
|
||||
void XmlReporter::benchmarkPreparing( StringRef name ) {
|
||||
void XmlReporter::benchmarkPreparing( std::string_view name ) {
|
||||
m_xml.startElement("BenchmarkResults")
|
||||
.writeAttribute("name"_sr, name);
|
||||
.writeAttribute("name", name);
|
||||
}
|
||||
|
||||
void XmlReporter::benchmarkStarting(BenchmarkInfo const &info) {
|
||||
m_xml.writeAttribute("samples"_sr, info.samples)
|
||||
.writeAttribute("resamples"_sr, info.resamples)
|
||||
.writeAttribute("iterations"_sr, info.iterations)
|
||||
.writeAttribute("clockResolution"_sr, info.clockResolution)
|
||||
.writeAttribute("estimatedDuration"_sr, info.estimatedDuration)
|
||||
.writeComment("All values in nano seconds"_sr);
|
||||
m_xml.writeAttribute("samples", info.samples)
|
||||
.writeAttribute("resamples", info.resamples)
|
||||
.writeAttribute("iterations", info.iterations)
|
||||
.writeAttribute("clockResolution", info.clockResolution)
|
||||
.writeAttribute("estimatedDuration", info.estimatedDuration)
|
||||
.writeComment("All values in nano seconds");
|
||||
}
|
||||
|
||||
void XmlReporter::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) {
|
||||
m_xml.scopedElement("mean")
|
||||
.writeAttribute("value"_sr, benchmarkStats.mean.point.count())
|
||||
.writeAttribute("lowerBound"_sr, benchmarkStats.mean.lower_bound.count())
|
||||
.writeAttribute("upperBound"_sr, benchmarkStats.mean.upper_bound.count())
|
||||
.writeAttribute("ci"_sr, benchmarkStats.mean.confidence_interval);
|
||||
.writeAttribute("value", benchmarkStats.mean.point.count())
|
||||
.writeAttribute("lowerBound", benchmarkStats.mean.lower_bound.count())
|
||||
.writeAttribute("upperBound", benchmarkStats.mean.upper_bound.count())
|
||||
.writeAttribute("ci", benchmarkStats.mean.confidence_interval);
|
||||
m_xml.scopedElement("standardDeviation")
|
||||
.writeAttribute("value"_sr, benchmarkStats.standardDeviation.point.count())
|
||||
.writeAttribute("lowerBound"_sr, benchmarkStats.standardDeviation.lower_bound.count())
|
||||
.writeAttribute("upperBound"_sr, benchmarkStats.standardDeviation.upper_bound.count())
|
||||
.writeAttribute("ci"_sr, benchmarkStats.standardDeviation.confidence_interval);
|
||||
.writeAttribute("value", benchmarkStats.standardDeviation.point.count())
|
||||
.writeAttribute("lowerBound", benchmarkStats.standardDeviation.lower_bound.count())
|
||||
.writeAttribute("upperBound", benchmarkStats.standardDeviation.upper_bound.count())
|
||||
.writeAttribute("ci", benchmarkStats.standardDeviation.confidence_interval);
|
||||
m_xml.scopedElement("outliers")
|
||||
.writeAttribute("variance"_sr, benchmarkStats.outlierVariance)
|
||||
.writeAttribute("lowMild"_sr, benchmarkStats.outliers.low_mild)
|
||||
.writeAttribute("lowSevere"_sr, benchmarkStats.outliers.low_severe)
|
||||
.writeAttribute("highMild"_sr, benchmarkStats.outliers.high_mild)
|
||||
.writeAttribute("highSevere"_sr, benchmarkStats.outliers.high_severe);
|
||||
.writeAttribute("variance", benchmarkStats.outlierVariance)
|
||||
.writeAttribute("lowMild", benchmarkStats.outliers.low_mild)
|
||||
.writeAttribute("lowSevere", benchmarkStats.outliers.low_severe)
|
||||
.writeAttribute("highMild", benchmarkStats.outliers.high_mild)
|
||||
.writeAttribute("highSevere", benchmarkStats.outliers.high_severe);
|
||||
m_xml.endElement();
|
||||
}
|
||||
|
||||
void XmlReporter::benchmarkFailed(StringRef error) {
|
||||
void XmlReporter::benchmarkFailed(std::string_view error) {
|
||||
m_xml.scopedElement("failed").
|
||||
writeAttribute("message"_sr, error);
|
||||
writeAttribute("message", error);
|
||||
m_xml.endElement();
|
||||
}
|
||||
|
||||
|
@@ -43,10 +43,10 @@ namespace Catch {
|
||||
|
||||
void testRunEnded(TestRunStats const& testRunStats) override;
|
||||
|
||||
void benchmarkPreparing( StringRef name ) override;
|
||||
void benchmarkPreparing( std::string_view name ) override;
|
||||
void benchmarkStarting(BenchmarkInfo const&) override;
|
||||
void benchmarkEnded(BenchmarkStats<> const&) override;
|
||||
void benchmarkFailed( StringRef error ) override;
|
||||
void benchmarkFailed( std::string_view error ) override;
|
||||
|
||||
void listReporters(std::vector<ReporterDescription> const& descriptions) override;
|
||||
void listListeners(std::vector<ListenerDescription> const& descriptions) override;
|
||||
|
@@ -38,7 +38,6 @@ cc_test(
|
||||
"SelfTest/IntrospectiveTests/Reporters.tests.cpp",
|
||||
"SelfTest/IntrospectiveTests/Sharding.tests.cpp",
|
||||
"SelfTest/IntrospectiveTests/Stream.tests.cpp",
|
||||
"SelfTest/IntrospectiveTests/String.tests.cpp",
|
||||
"SelfTest/IntrospectiveTests/StringManip.tests.cpp",
|
||||
"SelfTest/IntrospectiveTests/Tag.tests.cpp",
|
||||
"SelfTest/IntrospectiveTests/TestCaseInfoHasher.tests.cpp",
|
||||
|
@@ -92,7 +92,6 @@ set(TEST_SOURCES
|
||||
${SELF_TEST_DIR}/IntrospectiveTests/TextFlow.tests.cpp
|
||||
${SELF_TEST_DIR}/IntrospectiveTests/Sharding.tests.cpp
|
||||
${SELF_TEST_DIR}/IntrospectiveTests/Stream.tests.cpp
|
||||
${SELF_TEST_DIR}/IntrospectiveTests/String.tests.cpp
|
||||
${SELF_TEST_DIR}/IntrospectiveTests/StringManip.tests.cpp
|
||||
${SELF_TEST_DIR}/IntrospectiveTests/Xml.tests.cpp
|
||||
${SELF_TEST_DIR}/IntrospectiveTests/Traits.tests.cpp
|
||||
|
@@ -248,8 +248,6 @@ Message from section two
|
||||
:test-result: FAIL StartsWith string matcher
|
||||
:test-result: PASS Static arrays are convertible to string
|
||||
:test-result: PASS String matchers
|
||||
:test-result: PASS StringRef
|
||||
:test-result: PASS StringRef at compilation time
|
||||
:test-result: PASS Stringifying char arrays with statically known sizes - char
|
||||
:test-result: PASS Stringifying char arrays with statically known sizes - signed char
|
||||
:test-result: PASS Stringifying char arrays with statically known sizes - unsigned char
|
||||
|
@@ -241,8 +241,6 @@
|
||||
:test-result: FAIL StartsWith string matcher
|
||||
:test-result: PASS Static arrays are convertible to string
|
||||
:test-result: PASS String matchers
|
||||
:test-result: PASS StringRef
|
||||
:test-result: PASS StringRef at compilation time
|
||||
:test-result: PASS Stringifying char arrays with statically known sizes - char
|
||||
:test-result: PASS Stringifying char arrays with statically known sizes - signed char
|
||||
:test-result: PASS Stringifying char arrays with statically known sizes - unsigned char
|
||||
|
@@ -562,9 +562,9 @@ Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'c
|
||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom std exception'
|
||||
Approx.tests.cpp:<line number>: passed: 101.000001 != Approx(100).epsilon(0.01) for: 101.00000099999999748 != Approx( 100.0 )
|
||||
Approx.tests.cpp:<line number>: passed: std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 )
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: Value2 == "Value2"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **}
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(0) == "Value1" for: "Value1" == "Value1"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: "Value2" == "Value2"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: "{** unexpected enum value **}"
|
||||
==
|
||||
"{** unexpected enum value **}"
|
||||
Skip.tests.cpp:<line number>: skipped: 'This generator is empty'
|
||||
@@ -1807,61 +1807,6 @@ Matchers.tests.cpp:<line number>: passed: testStringForMatching(), StartsWith( "
|
||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" starts with: "this" (case insensitive)
|
||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith( "substring" ) for: "this string contains 'abc' as a substring" ends with: "substring"
|
||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive)
|
||||
String.tests.cpp:<line number>: passed: empty.empty() for: true
|
||||
String.tests.cpp:<line number>: passed: empty.size() == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: std::strcmp( empty.data(), "" ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: s.empty() == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: s.size() == 5 for: 5 == 5
|
||||
String.tests.cpp:<line number>: passed: std::strcmp( rawChars, "hello" ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: s.data() == rawChars for: "hello" == "hello"
|
||||
String.tests.cpp:<line number>: passed: original == "original"
|
||||
String.tests.cpp:<line number>: passed: original.data()
|
||||
String.tests.cpp:<line number>: passed: original.begin() == copy.begin() for: "original string" == "original string"
|
||||
String.tests.cpp:<line number>: passed: original.begin() == copy.begin() for: "original string" == "original string"
|
||||
String.tests.cpp:<line number>: passed: ss.empty() == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: ss.size() == 5 for: 5 == 5
|
||||
String.tests.cpp:<line number>: passed: std::strncmp( ss.data(), "hello", 5 ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: ss == "hello" for: hello == "hello"
|
||||
String.tests.cpp:<line number>: passed: ss.size() == 6 for: 6 == 6
|
||||
String.tests.cpp:<line number>: passed: std::strcmp( ss.data(), "world!" ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: s.data() == s2.data() for: "hello world!" == "hello world!"
|
||||
String.tests.cpp:<line number>: passed: s.data() == ss.data() for: "hello world!" == "hello world!"
|
||||
String.tests.cpp:<line number>: passed: s.substr(s.size() + 1, 123).empty() for: true
|
||||
String.tests.cpp:<line number>: passed: std::strcmp(ss.data(), "world!") == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: s.substr(1'000'000, 1).empty() for: true
|
||||
String.tests.cpp:<line number>: passed: reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) for: "Hello" != "Hello"
|
||||
String.tests.cpp:<line number>: passed: left == right for: Hello == Hello
|
||||
String.tests.cpp:<line number>: passed: left != left.substr(0, 3) for: Hello != Hel
|
||||
String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
|
||||
String.tests.cpp:<line number>: passed: sr.size() == stdStr.size() for: 17 == 17
|
||||
String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
|
||||
String.tests.cpp:<line number>: passed: sr.size() == stdStr.size() for: 17 == 17
|
||||
String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
|
||||
String.tests.cpp:<line number>: passed: sr.size() == stdStr.size() for: 17 == 17
|
||||
String.tests.cpp:<line number>: passed: stdStr == "a stringref" for: "a stringref" == "a stringref"
|
||||
String.tests.cpp:<line number>: passed: stdStr.size() == sr.size() for: 11 == 11
|
||||
String.tests.cpp:<line number>: passed: stdStr == "a stringref" for: "a stringref" == "a stringref"
|
||||
String.tests.cpp:<line number>: passed: stdStr.size() == sr.size() for: 11 == 11
|
||||
String.tests.cpp:<line number>: passed: lhs == "some string += the stringref contents" for: "some string += the stringref contents"
|
||||
==
|
||||
"some string += the stringref contents"
|
||||
String.tests.cpp:<line number>: passed: together == "abrakadabra" for: "abrakadabra" == "abrakadabra"
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'empty.size() == 0'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'empty.begin() == empty.end()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.size() == 3'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.data() == abc'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() == abc'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() != stringref.end()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.substr(10, 0).empty()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.substr(2, 1).data() == abc + 2'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref[1] == 'b''
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.size() == 2'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.data() == abc'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.begin() != shortened.end()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: '!(sr1.empty())'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'sr1.size() == 3'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'sr2.empty()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'sr2.size() == 0'
|
||||
ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc""
|
||||
ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc""
|
||||
ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc""
|
||||
@@ -1902,7 +1847,7 @@ Tag.tests.cpp:<line number>: passed: registry.add( "[the @ is not at the start]"
|
||||
Tag.tests.cpp:<line number>: passed: registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) )
|
||||
Tag.tests.cpp:<line number>: passed: registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) )
|
||||
Tag.tests.cpp:<line number>: passed: testCase.tags.size() == 2 for: 2 == 2
|
||||
Tag.tests.cpp:<line number>: passed: testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
Tag.tests.cpp:<line number>: passed: testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!" ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1
|
||||
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1
|
||||
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1.0 == 1
|
||||
@@ -2169,18 +2114,18 @@ StringManip.tests.cpp:<line number>: passed: trim(std::string(trailing_whitespac
|
||||
StringManip.tests.cpp:<line number>: passed: trim(std::string(whitespace_at_both_ends)) == no_whitespace for: "There is no extra whitespace here"
|
||||
==
|
||||
"There is no extra whitespace here"
|
||||
StringManip.tests.cpp:<line number>: passed: trim(StringRef(no_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here
|
||||
StringManip.tests.cpp:<line number>: passed: trim(std::string_view(no_whitespace)) == std::string_view(no_whitespace) for: "There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
StringManip.tests.cpp:<line number>: passed: trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
StringManip.tests.cpp:<line number>: passed: trim(std::string_view(leading_whitespace)) == std::string_view(no_whitespace) for: "There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
StringManip.tests.cpp:<line number>: passed: trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
StringManip.tests.cpp:<line number>: passed: trim(std::string_view(trailing_whitespace)) == std::string_view(no_whitespace) for: "There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
StringManip.tests.cpp:<line number>: passed: trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) for: There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
StringManip.tests.cpp:<line number>: passed: trim(std::string_view(whitespace_at_both_ends)) == std::string_view(no_whitespace) for: "There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
MatchersRanges.tests.cpp:<line number>: passed: array_int_a, RangeEquals( c_array ) for: { 1, 2, 3 } elements are { 1, 2, 3 }
|
||||
MatchersRanges.tests.cpp:<line number>: passed: array_int_a, UnorderedRangeEquals( c_array ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 }
|
||||
MatchersRanges.tests.cpp:<line number>: passed: array_int_3, !RangeEquals( array_int_4 ) for: { 1, 2, 3 } not elements are { 1, 2, 3, 4 }
|
||||
@@ -2646,13 +2591,13 @@ Tricky.tests.cpp:<line number>: passed: ptr.get() == 0 for: 0 == 0
|
||||
ToStringPair.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" for: "{ { 42, "Arthur" }, { "Ford", 24 } }"
|
||||
==
|
||||
"{ { 42, "Arthur" }, { "Ford", 24 } }"
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "" ), Equals( std::vector<Catch::StringRef>{} ) for: { } Equals: { }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "Value1" ), Equals( std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2"} ) for: { Value1, Value2 } Equals: { Value1, Value2 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) for: { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) for: { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "" ), Equals( std::vector<std::string_view>{} ) for: { } Equals: { }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<std::string_view>{"Value1"} ) for: { "Value1" } Equals: { "Value1" }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "Value1" ), Equals( std::vector<std::string_view>{"Value1"} ) for: { "Value1" } Equals: { "Value1" }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "EnumName::Value1" ), Equals(std::vector<std::string_view>{"Value1"} ) for: { "Value1" } Equals: { "Value1" }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<std::string_view>{"Value1", "Value2"} ) for: { "Value1", "Value2" } Equals: { "Value1", "Value2" }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<std::string_view>{"Value1", "Value2", "Value3"} ) for: { "Value1", "Value2", "Value3" } Equals: { "Value1", "Value2", "Value3" }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<std::string_view>{"Value1", "Value2", "Value3"} ) for: { "Value1", "Value2", "Value3" } Equals: { "Value1", "Value2", "Value3" }
|
||||
Tricky.tests.cpp:<line number>: passed: p == 0 for: 0 == 0
|
||||
Message.tests.cpp:<line number>: passed: true with 1 message: 'this MAY be seen IF info is printed for passing assertions'
|
||||
Message.tests.cpp:<line number>: failed: false with 2 messages: 'this SHOULD be seen' and 'this SHOULD also be seen'
|
||||
@@ -2719,16 +2664,16 @@ Skip.tests.cpp:<line number>: skipped:
|
||||
Skip.tests.cpp:<line number>: passed:
|
||||
Misc.tests.cpp:<line number>: failed: false with 1 message: '3'
|
||||
Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7'
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "." ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
Skip.tests.cpp:<line number>: skipped: 'skipping because answer = 43'
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) for: { abc } Equals: { abc }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<std::string_view>()) for: { } Equals: { }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<std::string_view>{"abc"}) for: { "abc" } Equals: { "abc" }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<std::string_view>{"abc", "def"}) for: { "abc", "def" } Equals: { "abc", "def" }
|
||||
Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 1 to 3...' and '1' and '2' and '3'
|
||||
Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 4 to 6...' and '4' and '5' and '6'
|
||||
StringManip.tests.cpp:<line number>: passed: !(startsWith("", 'c')) for: !false
|
||||
StringManip.tests.cpp:<line number>: passed: startsWith(std::string("abc"), 'a') for: true
|
||||
StringManip.tests.cpp:<line number>: passed: startsWith("def"_catch_sr, 'd') for: true
|
||||
StringManip.tests.cpp:<line number>: passed: startsWith("def", 'd') for: true
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( emptyMap ) == "{ }" for: "{ }" == "{ }"
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( map ) == "{ { \"one\", 1 } }" for: "{ { "one", 1 } }" == "{ { "one", 1 } }"
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( map ) == "{ { \"abc\", 1 }, { \"def\", 2 }, { \"ghi\", 3 } }" for: "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }"
|
||||
@@ -2788,7 +2733,7 @@ Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_
|
||||
Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 5 == 5
|
||||
Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 6 == 6
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags.size() == 1 for: 1 == 1
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags[0].original == "magic.tag"_catch_sr for: magic.tag == magic.tag
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags[0].original == "magic.tag" for: "magic.tag" == "magic.tag"
|
||||
Skip.tests.cpp:<line number>: skipped:
|
||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'Why would you throw a std::string?'
|
||||
Misc.tests.cpp:<line number>: passed: result == "\"wide load\"" for: ""wide load"" == ""wide load""
|
||||
@@ -2888,7 +2833,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
|
||||
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
|
||||
test cases: 433 | 315 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2250 | 2052 passed | 157 failed | 41 failed as expected
|
||||
|
||||
|
||||
|
@@ -560,9 +560,9 @@ Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'c
|
||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom std exception'
|
||||
Approx.tests.cpp:<line number>: passed: 101.000001 != Approx(100).epsilon(0.01) for: 101.00000099999999748 != Approx( 100.0 )
|
||||
Approx.tests.cpp:<line number>: passed: std::pow(10, -5) != Approx(std::pow(10, -7)) for: 0.00001 != Approx( 0.0000001 )
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: Value2 == "Value2"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **}
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(0) == "Value1" for: "Value1" == "Value1"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: "Value2" == "Value2"
|
||||
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: "{** unexpected enum value **}"
|
||||
==
|
||||
"{** unexpected enum value **}"
|
||||
Skip.tests.cpp:<line number>: skipped: 'This generator is empty'
|
||||
@@ -1800,61 +1800,6 @@ Matchers.tests.cpp:<line number>: passed: testStringForMatching(), StartsWith( "
|
||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching(), StartsWith( "THIS", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" starts with: "this" (case insensitive)
|
||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith( "substring" ) for: "this string contains 'abc' as a substring" ends with: "substring"
|
||||
Matchers.tests.cpp:<line number>: passed: testStringForMatching(), EndsWith( " SuBsTrInG", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: " substring" (case insensitive)
|
||||
String.tests.cpp:<line number>: passed: empty.empty() for: true
|
||||
String.tests.cpp:<line number>: passed: empty.size() == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: std::strcmp( empty.data(), "" ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: s.empty() == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: s.size() == 5 for: 5 == 5
|
||||
String.tests.cpp:<line number>: passed: std::strcmp( rawChars, "hello" ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: s.data() == rawChars for: "hello" == "hello"
|
||||
String.tests.cpp:<line number>: passed: original == "original"
|
||||
String.tests.cpp:<line number>: passed: original.data()
|
||||
String.tests.cpp:<line number>: passed: original.begin() == copy.begin() for: "original string" == "original string"
|
||||
String.tests.cpp:<line number>: passed: original.begin() == copy.begin() for: "original string" == "original string"
|
||||
String.tests.cpp:<line number>: passed: ss.empty() == false for: false == false
|
||||
String.tests.cpp:<line number>: passed: ss.size() == 5 for: 5 == 5
|
||||
String.tests.cpp:<line number>: passed: std::strncmp( ss.data(), "hello", 5 ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: ss == "hello" for: hello == "hello"
|
||||
String.tests.cpp:<line number>: passed: ss.size() == 6 for: 6 == 6
|
||||
String.tests.cpp:<line number>: passed: std::strcmp( ss.data(), "world!" ) == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: s.data() == s2.data() for: "hello world!" == "hello world!"
|
||||
String.tests.cpp:<line number>: passed: s.data() == ss.data() for: "hello world!" == "hello world!"
|
||||
String.tests.cpp:<line number>: passed: s.substr(s.size() + 1, 123).empty() for: true
|
||||
String.tests.cpp:<line number>: passed: std::strcmp(ss.data(), "world!") == 0 for: 0 == 0
|
||||
String.tests.cpp:<line number>: passed: s.substr(1'000'000, 1).empty() for: true
|
||||
String.tests.cpp:<line number>: passed: reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) for: "Hello" != "Hello"
|
||||
String.tests.cpp:<line number>: passed: left == right for: Hello == Hello
|
||||
String.tests.cpp:<line number>: passed: left != left.substr(0, 3) for: Hello != Hel
|
||||
String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
|
||||
String.tests.cpp:<line number>: passed: sr.size() == stdStr.size() for: 17 == 17
|
||||
String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
|
||||
String.tests.cpp:<line number>: passed: sr.size() == stdStr.size() for: 17 == 17
|
||||
String.tests.cpp:<line number>: passed: sr == "a standard string" for: a standard string == "a standard string"
|
||||
String.tests.cpp:<line number>: passed: sr.size() == stdStr.size() for: 17 == 17
|
||||
String.tests.cpp:<line number>: passed: stdStr == "a stringref" for: "a stringref" == "a stringref"
|
||||
String.tests.cpp:<line number>: passed: stdStr.size() == sr.size() for: 11 == 11
|
||||
String.tests.cpp:<line number>: passed: stdStr == "a stringref" for: "a stringref" == "a stringref"
|
||||
String.tests.cpp:<line number>: passed: stdStr.size() == sr.size() for: 11 == 11
|
||||
String.tests.cpp:<line number>: passed: lhs == "some string += the stringref contents" for: "some string += the stringref contents"
|
||||
==
|
||||
"some string += the stringref contents"
|
||||
String.tests.cpp:<line number>: passed: together == "abrakadabra" for: "abrakadabra" == "abrakadabra"
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'empty.size() == 0'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'empty.begin() == empty.end()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.size() == 3'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.data() == abc'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() == abc'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.begin() != stringref.end()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.substr(10, 0).empty()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref.substr(2, 1).data() == abc + 2'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'stringref[1] == 'b''
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.size() == 2'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.data() == abc'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'shortened.begin() != shortened.end()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: '!(sr1.empty())'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'sr1.size() == 3'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'sr2.empty()'
|
||||
String.tests.cpp:<line number>: passed: with 1 message: 'sr2.size() == 0'
|
||||
ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc""
|
||||
ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( no_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc""
|
||||
ToString.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( with_null_terminator ) == R"("abc")"s for: ""abc"" == ""abc""
|
||||
@@ -1895,7 +1840,7 @@ Tag.tests.cpp:<line number>: passed: registry.add( "[the @ is not at the start]"
|
||||
Tag.tests.cpp:<line number>: passed: registry.add( "@no square bracket at start]", "", Catch::SourceLineInfo( "file", 3 ) )
|
||||
Tag.tests.cpp:<line number>: passed: registry.add( "[@no square bracket at end", "", Catch::SourceLineInfo( "file", 3 ) )
|
||||
Tag.tests.cpp:<line number>: passed: testCase.tags.size() == 2 for: 2 == 2
|
||||
Tag.tests.cpp:<line number>: passed: testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
Tag.tests.cpp:<line number>: passed: testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!" ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1
|
||||
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1 == 1
|
||||
Class.tests.cpp:<line number>: passed: Template_Fixture<TestType>::m_a == 1 for: 1.0 == 1
|
||||
@@ -2162,18 +2107,18 @@ StringManip.tests.cpp:<line number>: passed: trim(std::string(trailing_whitespac
|
||||
StringManip.tests.cpp:<line number>: passed: trim(std::string(whitespace_at_both_ends)) == no_whitespace for: "There is no extra whitespace here"
|
||||
==
|
||||
"There is no extra whitespace here"
|
||||
StringManip.tests.cpp:<line number>: passed: trim(StringRef(no_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here
|
||||
StringManip.tests.cpp:<line number>: passed: trim(std::string_view(no_whitespace)) == std::string_view(no_whitespace) for: "There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
StringManip.tests.cpp:<line number>: passed: trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
StringManip.tests.cpp:<line number>: passed: trim(std::string_view(leading_whitespace)) == std::string_view(no_whitespace) for: "There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
StringManip.tests.cpp:<line number>: passed: trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) for: There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
StringManip.tests.cpp:<line number>: passed: trim(std::string_view(trailing_whitespace)) == std::string_view(no_whitespace) for: "There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
StringManip.tests.cpp:<line number>: passed: trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) for: There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
StringManip.tests.cpp:<line number>: passed: trim(std::string_view(whitespace_at_both_ends)) == std::string_view(no_whitespace) for: "There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
MatchersRanges.tests.cpp:<line number>: passed: array_int_a, RangeEquals( c_array ) for: { 1, 2, 3 } elements are { 1, 2, 3 }
|
||||
MatchersRanges.tests.cpp:<line number>: passed: array_int_a, UnorderedRangeEquals( c_array ) for: { 1, 2, 3 } unordered elements are { 1, 2, 3 }
|
||||
MatchersRanges.tests.cpp:<line number>: passed: array_int_3, !RangeEquals( array_int_4 ) for: { 1, 2, 3 } not elements are { 1, 2, 3, 4 }
|
||||
@@ -2635,13 +2580,13 @@ Tricky.tests.cpp:<line number>: passed: ptr.get() == 0 for: 0 == 0
|
||||
ToStringPair.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" for: "{ { 42, "Arthur" }, { "Ford", 24 } }"
|
||||
==
|
||||
"{ { 42, "Arthur" }, { "Ford", 24 } }"
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "" ), Equals( std::vector<Catch::StringRef>{} ) for: { } Equals: { }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "Value1" ), Equals( std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) for: { Value1 } Equals: { Value1 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2"} ) for: { Value1, Value2 } Equals: { Value1, Value2 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) for: { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) for: { Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "" ), Equals( std::vector<std::string_view>{} ) for: { } Equals: { }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<std::string_view>{"Value1"} ) for: { "Value1" } Equals: { "Value1" }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "Value1" ), Equals( std::vector<std::string_view>{"Value1"} ) for: { "Value1" } Equals: { "Value1" }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "EnumName::Value1" ), Equals(std::vector<std::string_view>{"Value1"} ) for: { "Value1" } Equals: { "Value1" }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<std::string_view>{"Value1", "Value2"} ) for: { "Value1", "Value2" } Equals: { "Value1", "Value2" }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<std::string_view>{"Value1", "Value2", "Value3"} ) for: { "Value1", "Value2", "Value3" } Equals: { "Value1", "Value2", "Value3" }
|
||||
ToString.tests.cpp:<line number>: passed: parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<std::string_view>{"Value1", "Value2", "Value3"} ) for: { "Value1", "Value2", "Value3" } Equals: { "Value1", "Value2", "Value3" }
|
||||
Tricky.tests.cpp:<line number>: passed: p == 0 for: 0 == 0
|
||||
Message.tests.cpp:<line number>: passed: true with 1 message: 'this MAY be seen IF info is printed for passing assertions'
|
||||
Message.tests.cpp:<line number>: failed: false with 2 messages: 'this SHOULD be seen' and 'this SHOULD also be seen'
|
||||
@@ -2708,16 +2653,16 @@ Skip.tests.cpp:<line number>: skipped:
|
||||
Skip.tests.cpp:<line number>: passed:
|
||||
Misc.tests.cpp:<line number>: failed: false with 1 message: '3'
|
||||
Message.tests.cpp:<line number>: failed: false with 2 messages: 'hi' and 'i := 7'
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "." ) ) for: { {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
Skip.tests.cpp:<line number>: skipped: 'skipping because answer = 43'
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<StringRef>()) for: { } Equals: { }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) for: { abc } Equals: { abc }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) for: { abc, def } Equals: { abc, def }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("", ','), Equals(std::vector<std::string_view>()) for: { } Equals: { }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc", ','), Equals(std::vector<std::string_view>{"abc"}) for: { "abc" } Equals: { "abc" }
|
||||
StringManip.tests.cpp:<line number>: passed: splitStringRef("abc,def", ','), Equals(std::vector<std::string_view>{"abc", "def"}) for: { "abc", "def" } Equals: { "abc", "def" }
|
||||
Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 1 to 3...' and '1' and '2' and '3'
|
||||
Message.tests.cpp:<line number>: failed: false with 4 messages: 'Count 4 to 6...' and '4' and '5' and '6'
|
||||
StringManip.tests.cpp:<line number>: passed: !(startsWith("", 'c')) for: !false
|
||||
StringManip.tests.cpp:<line number>: passed: startsWith(std::string("abc"), 'a') for: true
|
||||
StringManip.tests.cpp:<line number>: passed: startsWith("def"_catch_sr, 'd') for: true
|
||||
StringManip.tests.cpp:<line number>: passed: startsWith("def", 'd') for: true
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( emptyMap ) == "{ }" for: "{ }" == "{ }"
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( map ) == "{ { \"one\", 1 } }" for: "{ { "one", 1 } }" == "{ { "one", 1 } }"
|
||||
ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( map ) == "{ { \"abc\", 1 }, { \"def\", 2 }, { \"ghi\", 3 } }" for: "{ { "abc", 1 }, { "def", 2 }, { "ghi", 3 } }"
|
||||
@@ -2777,7 +2722,7 @@ Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_
|
||||
Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 5 == 5
|
||||
Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 6 == 6
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags.size() == 1 for: 1 == 1
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags[0].original == "magic.tag"_catch_sr for: magic.tag == magic.tag
|
||||
Tag.tests.cpp:<line number>: passed: testcase.tags[0].original == "magic.tag" for: "magic.tag" == "magic.tag"
|
||||
Skip.tests.cpp:<line number>: skipped:
|
||||
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'Why would you throw a std::string?'
|
||||
Misc.tests.cpp:<line number>: passed: result == "\"wide load\"" for: ""wide load"" == ""wide load""
|
||||
@@ -2877,7 +2822,7 @@ InternalBenchmark.tests.cpp:<line number>: passed: med == 18. for: 18.0 == 18.0
|
||||
InternalBenchmark.tests.cpp:<line number>: passed: q3 == 23. for: 23.0 == 23.0
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
Misc.tests.cpp:<line number>: passed:
|
||||
test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
|
||||
test cases: 433 | 315 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2250 | 2052 passed | 157 failed | 41 failed as expected
|
||||
|
||||
|
||||
|
@@ -1719,6 +1719,6 @@ due to unexpected exception with message:
|
||||
Why would you throw a std::string?
|
||||
|
||||
===============================================================================
|
||||
test cases: 435 | 335 passed | 76 failed | 7 skipped | 17 failed as expected
|
||||
assertions: 2282 | 2105 passed | 136 failed | 41 failed as expected
|
||||
test cases: 433 | 333 passed | 76 failed | 7 skipped | 17 failed as expected
|
||||
assertions: 2229 | 2052 passed | 136 failed | 41 failed as expected
|
||||
|
||||
|
@@ -4157,17 +4157,17 @@ ToString.tests.cpp:<line number>
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( enumInfo->lookup(0) == "Value1" )
|
||||
with expansion:
|
||||
Value1 == "Value1"
|
||||
"Value1" == "Value1"
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( enumInfo->lookup(1) == "Value2" )
|
||||
with expansion:
|
||||
Value2 == "Value2"
|
||||
"Value2" == "Value2"
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( enumInfo->lookup(3) == "{** unexpected enum value **}" )
|
||||
with expansion:
|
||||
{** unexpected enum value **}
|
||||
"{** unexpected enum value **}"
|
||||
==
|
||||
"{** unexpected enum value **}"
|
||||
|
||||
@@ -11458,419 +11458,6 @@ with expansion:
|
||||
"this string contains 'abc' as a substring" ends with: " substring" (case
|
||||
insensitive)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Empty string
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( empty.empty() )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( empty.size() == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strcmp( empty.data(), "" ) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
From string literal
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.empty() == false )
|
||||
with expansion:
|
||||
false == false
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.size() == 5 )
|
||||
with expansion:
|
||||
5 == 5
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strcmp( rawChars, "hello" ) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.data() == rawChars )
|
||||
with expansion:
|
||||
"hello" == "hello"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
From sub-string
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( original == "original" )
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_NOTHROW( original.data() )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Copy construction is shallow
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( original.begin() == copy.begin() )
|
||||
with expansion:
|
||||
"original string" == "original string"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Copy assignment is shallow
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( original.begin() == copy.begin() )
|
||||
with expansion:
|
||||
"original string" == "original string"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
zero-based substring
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( ss.empty() == false )
|
||||
with expansion:
|
||||
false == false
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( ss.size() == 5 )
|
||||
with expansion:
|
||||
5 == 5
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strncmp( ss.data(), "hello", 5 ) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( ss == "hello" )
|
||||
with expansion:
|
||||
hello == "hello"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
non-zero-based substring
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( ss.size() == 6 )
|
||||
with expansion:
|
||||
6 == 6
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strcmp( ss.data(), "world!" ) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
Pointer values of full refs should match
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.data() == s2.data() )
|
||||
with expansion:
|
||||
"hello world!" == "hello world!"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
Pointer values of substring refs should also match
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.data() == ss.data() )
|
||||
with expansion:
|
||||
"hello world!" == "hello world!"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
Past the end substring
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.substr(s.size() + 1, 123).empty() )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
Substring off the end are trimmed
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strcmp(ss.data(), "world!") == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
substring start after the end is empty
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.substr(1'000'000, 1).empty() )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Comparisons are deep
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
CHECK( reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) )
|
||||
with expansion:
|
||||
"Hello" != "Hello"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( left == right )
|
||||
with expansion:
|
||||
Hello == Hello
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( left != left.substr(0, 3) )
|
||||
with expansion:
|
||||
Hello != Hel
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
from std::string
|
||||
implicitly constructed
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr == "a standard string" )
|
||||
with expansion:
|
||||
a standard string == "a standard string"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr.size() == stdStr.size() )
|
||||
with expansion:
|
||||
17 == 17
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
from std::string
|
||||
explicitly constructed
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr == "a standard string" )
|
||||
with expansion:
|
||||
a standard string == "a standard string"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr.size() == stdStr.size() )
|
||||
with expansion:
|
||||
17 == 17
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
from std::string
|
||||
assigned
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr == "a standard string" )
|
||||
with expansion:
|
||||
a standard string == "a standard string"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr.size() == stdStr.size() )
|
||||
with expansion:
|
||||
17 == 17
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
to std::string
|
||||
explicitly constructed
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( stdStr == "a stringref" )
|
||||
with expansion:
|
||||
"a stringref" == "a stringref"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( stdStr.size() == sr.size() )
|
||||
with expansion:
|
||||
11 == 11
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
to std::string
|
||||
assigned
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( stdStr == "a stringref" )
|
||||
with expansion:
|
||||
"a stringref" == "a stringref"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( stdStr.size() == sr.size() )
|
||||
with expansion:
|
||||
11 == 11
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
std::string += StringRef
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( lhs == "some string += the stringref contents" )
|
||||
with expansion:
|
||||
"some string += the stringref contents"
|
||||
==
|
||||
"some string += the stringref contents"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
StringRef + StringRef
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( together == "abrakadabra" )
|
||||
with expansion:
|
||||
"abrakadabra" == "abrakadabra"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef at compilation time
|
||||
Simple constructors
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
empty.size() == 0
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
empty.begin() == empty.end()
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.size() == 3
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.data() == abc
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.begin() == abc
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.begin() != stringref.end()
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.substr(10, 0).empty()
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.substr(2, 1).data() == abc + 2
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref[1] == 'b'
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
shortened.size() == 2
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
shortened.data() == abc
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
shortened.begin() != shortened.end()
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef at compilation time
|
||||
UDL construction
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
!(sr1.empty())
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr1.size() == 3
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr2.empty()
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr2.size() == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Stringifying char arrays with statically known sizes - char
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -12058,7 +11645,7 @@ with expansion:
|
||||
2 == 2
|
||||
|
||||
Tag.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THAT( testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) )
|
||||
REQUIRE_THAT( testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!" ) ) )
|
||||
with expansion:
|
||||
{ {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
|
||||
@@ -14085,32 +13672,32 @@ with expansion:
|
||||
"There is no extra whitespace here"
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( trim(StringRef(no_whitespace)) == StringRef(no_whitespace) )
|
||||
REQUIRE( trim(std::string_view(no_whitespace)) == std::string_view(no_whitespace) )
|
||||
with expansion:
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) )
|
||||
REQUIRE( trim(std::string_view(leading_whitespace)) == std::string_view(no_whitespace) )
|
||||
with expansion:
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) )
|
||||
REQUIRE( trim(std::string_view(trailing_whitespace)) == std::string_view(no_whitespace) )
|
||||
with expansion:
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) )
|
||||
REQUIRE( trim(std::string_view(whitespace_at_both_ends)) == std::string_view(no_whitespace) )
|
||||
with expansion:
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Type conversions of RangeEquals and similar
|
||||
@@ -17569,7 +17156,7 @@ ToString.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "" ), Equals( std::vector<Catch::StringRef>{} ) )
|
||||
CHECK_THAT( parseEnums( "" ), Equals( std::vector<std::string_view>{} ) )
|
||||
with expansion:
|
||||
{ } Equals: { }
|
||||
|
||||
@@ -17581,19 +17168,19 @@ ToString.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) )
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<std::string_view>{"Value1"} ) )
|
||||
with expansion:
|
||||
{ Value1 } Equals: { Value1 }
|
||||
{ "Value1" } Equals: { "Value1" }
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "Value1" ), Equals( std::vector<Catch::StringRef>{"Value1"} ) )
|
||||
CHECK_THAT( parseEnums( "Value1" ), Equals( std::vector<std::string_view>{"Value1"} ) )
|
||||
with expansion:
|
||||
{ Value1 } Equals: { Value1 }
|
||||
{ "Value1" } Equals: { "Value1" }
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) )
|
||||
CHECK_THAT( parseEnums( "EnumName::Value1" ), Equals(std::vector<std::string_view>{"Value1"} ) )
|
||||
with expansion:
|
||||
{ Value1 } Equals: { Value1 }
|
||||
{ "Value1" } Equals: { "Value1" }
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
parseEnums
|
||||
@@ -17603,19 +17190,19 @@ ToString.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2"} ) )
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<std::string_view>{"Value1", "Value2"} ) )
|
||||
with expansion:
|
||||
{ Value1, Value2 } Equals: { Value1, Value2 }
|
||||
{ "Value1", "Value2" } Equals: { "Value1", "Value2" }
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) )
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<std::string_view>{"Value1", "Value2", "Value3"} ) )
|
||||
with expansion:
|
||||
{ Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 }
|
||||
{ "Value1", "Value2", "Value3" } Equals: { "Value1", "Value2", "Value3" }
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) )
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<std::string_view>{"Value1", "Value2", "Value3"} ) )
|
||||
with expansion:
|
||||
{ Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 }
|
||||
{ "Value1", "Value2", "Value3" } Equals: { "Value1", "Value2", "Value3" }
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
pointer to class
|
||||
@@ -18110,7 +17697,7 @@ Tag.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Tag.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THAT( testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) )
|
||||
REQUIRE_THAT( testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "." ) ) )
|
||||
with expansion:
|
||||
{ {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
|
||||
@@ -18131,19 +17718,19 @@ StringManip.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( splitStringRef("", ','), Equals(std::vector<StringRef>()) )
|
||||
CHECK_THAT( splitStringRef("", ','), Equals(std::vector<std::string_view>()) )
|
||||
with expansion:
|
||||
{ } Equals: { }
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) )
|
||||
CHECK_THAT( splitStringRef("abc", ','), Equals(std::vector<std::string_view>{"abc"}) )
|
||||
with expansion:
|
||||
{ abc } Equals: { abc }
|
||||
{ "abc" } Equals: { "abc" }
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) )
|
||||
CHECK_THAT( splitStringRef("abc,def", ','), Equals(std::vector<std::string_view>{"abc", "def"}) )
|
||||
with expansion:
|
||||
{ abc, def } Equals: { abc, def }
|
||||
{ "abc", "def" } Equals: { "abc", "def" }
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
stacks unscoped info in loops
|
||||
@@ -18184,7 +17771,7 @@ with expansion:
|
||||
true
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( startsWith("def"_catch_sr, 'd') )
|
||||
CHECK( startsWith("def", 'd') )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
@@ -18560,9 +18147,9 @@ with expansion:
|
||||
1 == 1
|
||||
|
||||
Tag.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( testcase.tags[0].original == "magic.tag"_catch_sr )
|
||||
REQUIRE( testcase.tags[0].original == "magic.tag" )
|
||||
with expansion:
|
||||
magic.tag == magic.tag
|
||||
"magic.tag" == "magic.tag"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
tests can be skipped dynamically at runtime
|
||||
@@ -19295,6 +18882,6 @@ Misc.tests.cpp:<line number>
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
|
||||
test cases: 433 | 315 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2250 | 2052 passed | 157 failed | 41 failed as expected
|
||||
|
||||
|
@@ -4155,17 +4155,17 @@ ToString.tests.cpp:<line number>
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( enumInfo->lookup(0) == "Value1" )
|
||||
with expansion:
|
||||
Value1 == "Value1"
|
||||
"Value1" == "Value1"
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( enumInfo->lookup(1) == "Value2" )
|
||||
with expansion:
|
||||
Value2 == "Value2"
|
||||
"Value2" == "Value2"
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK( enumInfo->lookup(3) == "{** unexpected enum value **}" )
|
||||
with expansion:
|
||||
{** unexpected enum value **}
|
||||
"{** unexpected enum value **}"
|
||||
==
|
||||
"{** unexpected enum value **}"
|
||||
|
||||
@@ -11451,419 +11451,6 @@ with expansion:
|
||||
"this string contains 'abc' as a substring" ends with: " substring" (case
|
||||
insensitive)
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Empty string
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( empty.empty() )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( empty.size() == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strcmp( empty.data(), "" ) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
From string literal
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.empty() == false )
|
||||
with expansion:
|
||||
false == false
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.size() == 5 )
|
||||
with expansion:
|
||||
5 == 5
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strcmp( rawChars, "hello" ) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.data() == rawChars )
|
||||
with expansion:
|
||||
"hello" == "hello"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
From sub-string
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( original == "original" )
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_NOTHROW( original.data() )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Copy construction is shallow
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( original.begin() == copy.begin() )
|
||||
with expansion:
|
||||
"original string" == "original string"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Copy assignment is shallow
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( original.begin() == copy.begin() )
|
||||
with expansion:
|
||||
"original string" == "original string"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
zero-based substring
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( ss.empty() == false )
|
||||
with expansion:
|
||||
false == false
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( ss.size() == 5 )
|
||||
with expansion:
|
||||
5 == 5
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strncmp( ss.data(), "hello", 5 ) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( ss == "hello" )
|
||||
with expansion:
|
||||
hello == "hello"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
non-zero-based substring
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( ss.size() == 6 )
|
||||
with expansion:
|
||||
6 == 6
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strcmp( ss.data(), "world!" ) == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
Pointer values of full refs should match
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.data() == s2.data() )
|
||||
with expansion:
|
||||
"hello world!" == "hello world!"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
Pointer values of substring refs should also match
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.data() == ss.data() )
|
||||
with expansion:
|
||||
"hello world!" == "hello world!"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
Past the end substring
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.substr(s.size() + 1, 123).empty() )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
Substring off the end are trimmed
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( std::strcmp(ss.data(), "world!") == 0 )
|
||||
with expansion:
|
||||
0 == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Substrings
|
||||
substring start after the end is empty
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( s.substr(1'000'000, 1).empty() )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
Comparisons are deep
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
CHECK( reinterpret_cast<char*>(buffer1) != reinterpret_cast<char*>(buffer2) )
|
||||
with expansion:
|
||||
"Hello" != "Hello"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( left == right )
|
||||
with expansion:
|
||||
Hello == Hello
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( left != left.substr(0, 3) )
|
||||
with expansion:
|
||||
Hello != Hel
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
from std::string
|
||||
implicitly constructed
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr == "a standard string" )
|
||||
with expansion:
|
||||
a standard string == "a standard string"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr.size() == stdStr.size() )
|
||||
with expansion:
|
||||
17 == 17
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
from std::string
|
||||
explicitly constructed
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr == "a standard string" )
|
||||
with expansion:
|
||||
a standard string == "a standard string"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr.size() == stdStr.size() )
|
||||
with expansion:
|
||||
17 == 17
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
from std::string
|
||||
assigned
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr == "a standard string" )
|
||||
with expansion:
|
||||
a standard string == "a standard string"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( sr.size() == stdStr.size() )
|
||||
with expansion:
|
||||
17 == 17
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
to std::string
|
||||
explicitly constructed
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( stdStr == "a stringref" )
|
||||
with expansion:
|
||||
"a stringref" == "a stringref"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( stdStr.size() == sr.size() )
|
||||
with expansion:
|
||||
11 == 11
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
to std::string
|
||||
assigned
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( stdStr == "a stringref" )
|
||||
with expansion:
|
||||
"a stringref" == "a stringref"
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( stdStr.size() == sr.size() )
|
||||
with expansion:
|
||||
11 == 11
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
std::string += StringRef
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( lhs == "some string += the stringref contents" )
|
||||
with expansion:
|
||||
"some string += the stringref contents"
|
||||
==
|
||||
"some string += the stringref contents"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef
|
||||
StringRef + StringRef
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( together == "abrakadabra" )
|
||||
with expansion:
|
||||
"abrakadabra" == "abrakadabra"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef at compilation time
|
||||
Simple constructors
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
empty.size() == 0
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
empty.begin() == empty.end()
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.size() == 3
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.data() == abc
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.begin() == abc
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.begin() != stringref.end()
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.substr(10, 0).empty()
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref.substr(2, 1).data() == abc + 2
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
stringref[1] == 'b'
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
shortened.size() == 2
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
shortened.data() == abc
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
shortened.begin() != shortened.end()
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
StringRef at compilation time
|
||||
UDL construction
|
||||
-------------------------------------------------------------------------------
|
||||
String.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
!(sr1.empty())
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr1.size() == 3
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr2.empty()
|
||||
|
||||
String.tests.cpp:<line number>: PASSED:
|
||||
with message:
|
||||
sr2.size() == 0
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Stringifying char arrays with statically known sizes - char
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -12051,7 +11638,7 @@ with expansion:
|
||||
2 == 2
|
||||
|
||||
Tag.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THAT( testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!"_catch_sr ) ) )
|
||||
REQUIRE_THAT( testCase.tags, VectorContains( Tag( "tag with spaces" ) ) && VectorContains( Tag( "I said \"good day\" sir!" ) ) )
|
||||
with expansion:
|
||||
{ {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
|
||||
@@ -14078,32 +13665,32 @@ with expansion:
|
||||
"There is no extra whitespace here"
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( trim(StringRef(no_whitespace)) == StringRef(no_whitespace) )
|
||||
REQUIRE( trim(std::string_view(no_whitespace)) == std::string_view(no_whitespace) )
|
||||
with expansion:
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( trim(StringRef(leading_whitespace)) == StringRef(no_whitespace) )
|
||||
REQUIRE( trim(std::string_view(leading_whitespace)) == std::string_view(no_whitespace) )
|
||||
with expansion:
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( trim(StringRef(trailing_whitespace)) == StringRef(no_whitespace) )
|
||||
REQUIRE( trim(std::string_view(trailing_whitespace)) == std::string_view(no_whitespace) )
|
||||
with expansion:
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( trim(StringRef(whitespace_at_both_ends)) == StringRef(no_whitespace) )
|
||||
REQUIRE( trim(std::string_view(whitespace_at_both_ends)) == std::string_view(no_whitespace) )
|
||||
with expansion:
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
==
|
||||
There is no extra whitespace here
|
||||
"There is no extra whitespace here"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Type conversions of RangeEquals and similar
|
||||
@@ -17558,7 +17145,7 @@ ToString.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "" ), Equals( std::vector<Catch::StringRef>{} ) )
|
||||
CHECK_THAT( parseEnums( "" ), Equals( std::vector<std::string_view>{} ) )
|
||||
with expansion:
|
||||
{ } Equals: { }
|
||||
|
||||
@@ -17570,19 +17157,19 @@ ToString.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) )
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1" ), Equals(std::vector<std::string_view>{"Value1"} ) )
|
||||
with expansion:
|
||||
{ Value1 } Equals: { Value1 }
|
||||
{ "Value1" } Equals: { "Value1" }
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "Value1" ), Equals( std::vector<Catch::StringRef>{"Value1"} ) )
|
||||
CHECK_THAT( parseEnums( "Value1" ), Equals( std::vector<std::string_view>{"Value1"} ) )
|
||||
with expansion:
|
||||
{ Value1 } Equals: { Value1 }
|
||||
{ "Value1" } Equals: { "Value1" }
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "EnumName::Value1" ), Equals(std::vector<Catch::StringRef>{"Value1"} ) )
|
||||
CHECK_THAT( parseEnums( "EnumName::Value1" ), Equals(std::vector<std::string_view>{"Value1"} ) )
|
||||
with expansion:
|
||||
{ Value1 } Equals: { Value1 }
|
||||
{ "Value1" } Equals: { "Value1" }
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
parseEnums
|
||||
@@ -17592,19 +17179,19 @@ ToString.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2"} ) )
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2" ), Equals( std::vector<std::string_view>{"Value1", "Value2"} ) )
|
||||
with expansion:
|
||||
{ Value1, Value2 } Equals: { Value1, Value2 }
|
||||
{ "Value1", "Value2" } Equals: { "Value1", "Value2" }
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) )
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1, ClassName::EnumName::Value2, ClassName::EnumName::Value3" ), Equals( std::vector<std::string_view>{"Value1", "Value2", "Value3"} ) )
|
||||
with expansion:
|
||||
{ Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 }
|
||||
{ "Value1", "Value2", "Value3" } Equals: { "Value1", "Value2", "Value3" }
|
||||
|
||||
ToString.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<Catch::StringRef>{"Value1", "Value2", "Value3"} ) )
|
||||
CHECK_THAT( parseEnums( "ClassName::EnumName::Value1,ClassName::EnumName::Value2 , ClassName::EnumName::Value3" ), Equals( std::vector<std::string_view>{"Value1", "Value2", "Value3"} ) )
|
||||
with expansion:
|
||||
{ Value1, Value2, Value3 } Equals: { Value1, Value2, Value3 }
|
||||
{ "Value1", "Value2", "Value3" } Equals: { "Value1", "Value2", "Value3" }
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
pointer to class
|
||||
@@ -18099,7 +17686,7 @@ Tag.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Tag.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THAT( testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "."_catch_sr ) ) )
|
||||
REQUIRE_THAT( testcase.tags, VectorContains( Tag( "magic-tag" ) ) && VectorContains( Tag( "." ) ) )
|
||||
with expansion:
|
||||
{ {?}, {?} } ( Contains: {?} and Contains: {?} )
|
||||
|
||||
@@ -18120,19 +17707,19 @@ StringManip.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( splitStringRef("", ','), Equals(std::vector<StringRef>()) )
|
||||
CHECK_THAT( splitStringRef("", ','), Equals(std::vector<std::string_view>()) )
|
||||
with expansion:
|
||||
{ } Equals: { }
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( splitStringRef("abc", ','), Equals(std::vector<StringRef>{"abc"}) )
|
||||
CHECK_THAT( splitStringRef("abc", ','), Equals(std::vector<std::string_view>{"abc"}) )
|
||||
with expansion:
|
||||
{ abc } Equals: { abc }
|
||||
{ "abc" } Equals: { "abc" }
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK_THAT( splitStringRef("abc,def", ','), Equals(std::vector<StringRef>{"abc", "def"}) )
|
||||
CHECK_THAT( splitStringRef("abc,def", ','), Equals(std::vector<std::string_view>{"abc", "def"}) )
|
||||
with expansion:
|
||||
{ abc, def } Equals: { abc, def }
|
||||
{ "abc", "def" } Equals: { "abc", "def" }
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
stacks unscoped info in loops
|
||||
@@ -18173,7 +17760,7 @@ with expansion:
|
||||
true
|
||||
|
||||
StringManip.tests.cpp:<line number>: PASSED:
|
||||
CHECK( startsWith("def"_catch_sr, 'd') )
|
||||
CHECK( startsWith("def", 'd') )
|
||||
with expansion:
|
||||
true
|
||||
|
||||
@@ -18549,9 +18136,9 @@ with expansion:
|
||||
1 == 1
|
||||
|
||||
Tag.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( testcase.tags[0].original == "magic.tag"_catch_sr )
|
||||
REQUIRE( testcase.tags[0].original == "magic.tag" )
|
||||
with expansion:
|
||||
magic.tag == magic.tag
|
||||
"magic.tag" == "magic.tag"
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
tests can be skipped dynamically at runtime
|
||||
@@ -19284,6 +18871,6 @@ Misc.tests.cpp:<line number>
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 435 | 317 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2303 | 2105 passed | 157 failed | 41 failed as expected
|
||||
test cases: 433 | 315 passed | 95 failed | 6 skipped | 17 failed as expected
|
||||
assertions: 2250 | 2052 passed | 157 failed | 41 failed as expected
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user