mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 21:36:11 +01:00
Use SecondaryText code in lists
This commit is contained in:
parent
c7e602f3f2
commit
2a17ef9081
@ -90,6 +90,7 @@ namespace {
|
|||||||
const char* Cyan = "[0;36m";
|
const char* Cyan = "[0;36m";
|
||||||
const char* Yellow = "[0;33m";
|
const char* Yellow = "[0;33m";
|
||||||
const char* LightGrey = "[0;37m";
|
const char* LightGrey = "[0;37m";
|
||||||
|
// const char* DarkGrey = "[1;30m";
|
||||||
|
|
||||||
struct AnsiConsoleColourCodes : IConsoleColourCodes {
|
struct AnsiConsoleColourCodes : IConsoleColourCodes {
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "catch_commandline.hpp"
|
#include "catch_commandline.hpp"
|
||||||
#include "catch_line_wrap.h"
|
#include "catch_line_wrap.h"
|
||||||
|
#include "catch_console_colour.hpp"
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -63,17 +64,31 @@ namespace Catch {
|
|||||||
tagsWrapper.setRight( maxTagLen ).wrap( it->getTestCaseInfo().tagsAsString );
|
tagsWrapper.setRight( maxTagLen ).wrap( it->getTestCaseInfo().tagsAsString );
|
||||||
|
|
||||||
for( std::size_t i = 0; i < std::max( nameWrapper.size(), tagsWrapper.size() ); ++i ) {
|
for( std::size_t i = 0; i < std::max( nameWrapper.size(), tagsWrapper.size() ); ++i ) {
|
||||||
|
TextColour::Colours colour = TextColour::None;
|
||||||
|
if( it->getTestCaseInfo().isHidden )
|
||||||
|
colour = TextColour::SecondaryText;
|
||||||
std::string nameCol;
|
std::string nameCol;
|
||||||
if( i < nameWrapper.size() )
|
if( i < nameWrapper.size() ) {
|
||||||
nameCol = nameWrapper[i];
|
nameCol = nameWrapper[i];
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
nameCol = " ...";
|
nameCol = " ...";
|
||||||
|
colour = TextColour::SecondaryText;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
TextColour colourGuard( colour );
|
||||||
std::cout << nameCol;
|
std::cout << nameCol;
|
||||||
|
}
|
||||||
if( i < tagsWrapper.size() && !tagsWrapper[i].empty() ) {
|
if( i < tagsWrapper.size() && !tagsWrapper[i].empty() ) {
|
||||||
if( i == 0 )
|
if( i == 0 ) {
|
||||||
std::cout << " " << std::string( maxNameLen - nameCol.size(), '.' ) << " " << tagsWrapper[i];
|
TextColour colourGuard( TextColour::SecondaryText );
|
||||||
else
|
std::cout << " " << std::string( maxNameLen - nameCol.size(), '.' ) << " ";
|
||||||
std::cout << std::string( maxNameLen - nameCol.size(), ' ' ) << " " << tagsWrapper[i];
|
}
|
||||||
|
else {
|
||||||
|
std::cout << std::string( maxNameLen - nameCol.size(), ' ' ) << " ";
|
||||||
|
}
|
||||||
|
std::cout << tagsWrapper[i];
|
||||||
}
|
}
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
}
|
}
|
||||||
@ -124,10 +139,14 @@ namespace Catch {
|
|||||||
wrapper.setIndent(2).setRight( maxTagLen ).wrap( countIt->first );
|
wrapper.setIndent(2).setRight( maxTagLen ).wrap( countIt->first );
|
||||||
|
|
||||||
std::cout << wrapper;
|
std::cout << wrapper;
|
||||||
|
std::size_t dots = 2;
|
||||||
if( maxTagLen > wrapper.last().size() )
|
if( maxTagLen > wrapper.last().size() )
|
||||||
std::cout << std::string( maxTagLen - wrapper.last().size(), '.' );
|
dots += maxTagLen - wrapper.last().size();
|
||||||
std::cout << ".. "
|
{
|
||||||
<< countIt->second
|
TextColour colourGuard( TextColour::SecondaryText );
|
||||||
|
std::cout << std::string( dots, '.' );
|
||||||
|
}
|
||||||
|
std::cout << countIt->second
|
||||||
<< "\n";
|
<< "\n";
|
||||||
}
|
}
|
||||||
std::cout << pluralise( tagCounts.size(), "tag" ) << std::endl;
|
std::cout << pluralise( tagCounts.size(), "tag" ) << std::endl;
|
||||||
|
@ -253,6 +253,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
void lazyPrintRunInfo() {
|
void lazyPrintRunInfo() {
|
||||||
stream << "\n" << getTildes() << "\n";
|
stream << "\n" << getTildes() << "\n";
|
||||||
|
TextColour colour( TextColour::SecondaryText );
|
||||||
stream << testRunInfo->name
|
stream << testRunInfo->name
|
||||||
<< " is a CATCH v" << libraryVersion.majorVersion << "."
|
<< " is a CATCH v" << libraryVersion.majorVersion << "."
|
||||||
<< libraryVersion.minorVersion << " b"
|
<< libraryVersion.minorVersion << " b"
|
||||||
|
Loading…
Reference in New Issue
Block a user