+
+
+
+
diff --git a/projects/VS2010/TestCatch/TestCatch.sln b/projects/VS2010/TestCatch/TestCatch.sln
index c48e0a59..efb4502b 100644
--- a/projects/VS2010/TestCatch/TestCatch.sln
+++ b/projects/VS2010/TestCatch/TestCatch.sln
@@ -1,20 +1,20 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCatch", "TestCatch\TestCatch.vcxproj", "{A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Debug|Win32.ActiveCfg = Debug|Win32
- {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Debug|Win32.Build.0 = Debug|Win32
- {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Release|Win32.ActiveCfg = Release|Win32
- {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Release|Win32.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCatch", "TestCatch\TestCatch.vcxproj", "{A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Debug|Win32.Build.0 = Debug|Win32
+ {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Release|Win32.ActiveCfg = Release|Win32
+ {A2F23B19-9CF7-4246-AE58-BC65E39C6F7E}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/projects/VS2010/TestCatch/TestCatch/ReadMe.txt b/projects/VS2010/TestCatch/TestCatch/ReadMe.txt
index 597d267b..139e3319 100644
--- a/projects/VS2010/TestCatch/TestCatch/ReadMe.txt
+++ b/projects/VS2010/TestCatch/TestCatch/ReadMe.txt
@@ -1,33 +1,33 @@
-========================================================================
- CONSOLE APPLICATION : TestCatch Project Overview
-========================================================================
-
-AppWizard has created this TestCatch application for you.
-
-This file contains a summary of what you will find in each of the files that
-make up your TestCatch application.
-
-
-TestCatch.vcproj
- This is the main project file for VC++ projects generated using an Application Wizard.
- It contains information about the version of Visual C++ that generated the file, and
- information about the platforms, configurations, and project features selected with the
- Application Wizard.
-
-TestCatch.cpp
- This is the main application source file.
-
-/////////////////////////////////////////////////////////////////////////////
-Other standard files:
-
-StdAfx.h, StdAfx.cpp
- These files are used to build a precompiled header (PCH) file
- named TestCatch.pch and a precompiled types file named StdAfx.obj.
-
-/////////////////////////////////////////////////////////////////////////////
-Other notes:
-
-AppWizard uses "TODO:" comments to indicate parts of the source code you
-should add to or customize.
-
-/////////////////////////////////////////////////////////////////////////////
+========================================================================
+ CONSOLE APPLICATION : TestCatch Project Overview
+========================================================================
+
+AppWizard has created this TestCatch application for you.
+
+This file contains a summary of what you will find in each of the files that
+make up your TestCatch application.
+
+
+TestCatch.vcproj
+ This is the main project file for VC++ projects generated using an Application Wizard.
+ It contains information about the version of Visual C++ that generated the file, and
+ information about the platforms, configurations, and project features selected with the
+ Application Wizard.
+
+TestCatch.cpp
+ This is the main application source file.
+
+/////////////////////////////////////////////////////////////////////////////
+Other standard files:
+
+StdAfx.h, StdAfx.cpp
+ These files are used to build a precompiled header (PCH) file
+ named TestCatch.pch and a precompiled types file named StdAfx.obj.
+
+/////////////////////////////////////////////////////////////////////////////
+Other notes:
+
+AppWizard uses "TODO:" comments to indicate parts of the source code you
+should add to or customize.
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/projects/VS2010/TestCatch/TestCatch/TestCatch.cpp b/projects/VS2010/TestCatch/TestCatch/TestCatch.cpp
index c2fa801e..8dd2067d 100644
--- a/projects/VS2010/TestCatch/TestCatch/TestCatch.cpp
+++ b/projects/VS2010/TestCatch/TestCatch/TestCatch.cpp
@@ -1,8 +1,8 @@
-// TestCatch.cpp : Defines the entry point for the console application.
-//
-
-int main(int argc, char* argv[])
-{
- return 0;
-}
-
+// TestCatch.cpp : Defines the entry point for the console application.
+//
+
+int main(int argc, char* argv[])
+{
+ return 0;
+}
+
diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest/CatchSelfTest.1 b/projects/XCode4/CatchSelfTest/CatchSelfTest/CatchSelfTest.1
index 23d3cac2..28b36e20 100644
--- a/projects/XCode4/CatchSelfTest/CatchSelfTest/CatchSelfTest.1
+++ b/projects/XCode4/CatchSelfTest/CatchSelfTest/CatchSelfTest.1
@@ -1,79 +1,79 @@
-.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
-.\"See Also:
-.\"man mdoc.samples for a complete listing of options
-.\"man mdoc for the short list of editing options
-.\"/usr/share/misc/mdoc.template
-.Dd 16/12/2011 \" DATE
-.Dt CatchSelfTest 1 \" Program name and manual section number
-.Os Darwin
-.Sh NAME \" Section Header - required - don't modify
-.Nm CatchSelfTest,
-.\" The following lines are read in generating the apropos(man -k) database. Use only key
-.\" words here as the database is built based on the words here and in the .ND line.
-.Nm Other_name_for_same_program(),
-.Nm Yet another name for the same program.
-.\" Use .Nm macro to designate other names for the documented program.
-.Nd This line parsed for whatis database.
-.Sh SYNOPSIS \" Section Header - required - don't modify
-.Nm
-.Op Fl abcd \" [-abcd]
-.Op Fl a Ar path \" [-a path]
-.Op Ar file \" [file]
-.Op Ar \" [file ...]
-.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
-arg2 ... \" Arguments
-.Sh DESCRIPTION \" Section Header - required - don't modify
-Use the .Nm macro to refer to your program throughout the man page like such:
-.Nm
-Underlining is accomplished with the .Ar macro like this:
-.Ar underlined text .
-.Pp \" Inserts a space
-A list of items with descriptions:
-.Bl -tag -width -indent \" Begins a tagged list
-.It item a \" Each item preceded by .It macro
-Description of item a
-.It item b
-Description of item b
-.El \" Ends the list
-.Pp
-A list of flags and their descriptions:
-.Bl -tag -width -indent \" Differs from above in tag removed
-.It Fl a \"-a flag as a list item
-Description of -a flag
-.It Fl b
-Description of -b flag
-.El \" Ends the list
-.Pp
-.\" .Sh ENVIRONMENT \" May not be needed
-.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
-.\" .It Ev ENV_VAR_1
-.\" Description of ENV_VAR_1
-.\" .It Ev ENV_VAR_2
-.\" Description of ENV_VAR_2
-.\" .El
-.Sh FILES \" File used or created by the topic of the man page
-.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
-.It Pa /usr/share/file_name
-FILE_1 description
-.It Pa /Users/joeuser/Library/really_long_file_name
-FILE_2 description
-.El \" Ends the list
-.\" .Sh DIAGNOSTICS \" May not be needed
-.\" .Bl -diag
-.\" .It Diagnostic Tag
-.\" Diagnostic informtion here.
-.\" .It Diagnostic Tag
-.\" Diagnostic informtion here.
-.\" .El
-.Sh SEE ALSO
-.\" List links in ascending order by section, alphabetically within a section.
-.\" Please do not reference files that do not exist without filing a bug report
-.Xr a 1 ,
-.Xr b 1 ,
-.Xr c 1 ,
-.Xr a 2 ,
-.Xr b 2 ,
-.Xr a 3 ,
-.Xr b 3
-.\" .Sh BUGS \" Document known, unremedied bugs
+.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
+.\"See Also:
+.\"man mdoc.samples for a complete listing of options
+.\"man mdoc for the short list of editing options
+.\"/usr/share/misc/mdoc.template
+.Dd 16/12/2011 \" DATE
+.Dt CatchSelfTest 1 \" Program name and manual section number
+.Os Darwin
+.Sh NAME \" Section Header - required - don't modify
+.Nm CatchSelfTest,
+.\" The following lines are read in generating the apropos(man -k) database. Use only key
+.\" words here as the database is built based on the words here and in the .ND line.
+.Nm Other_name_for_same_program(),
+.Nm Yet another name for the same program.
+.\" Use .Nm macro to designate other names for the documented program.
+.Nd This line parsed for whatis database.
+.Sh SYNOPSIS \" Section Header - required - don't modify
+.Nm
+.Op Fl abcd \" [-abcd]
+.Op Fl a Ar path \" [-a path]
+.Op Ar file \" [file]
+.Op Ar \" [file ...]
+.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
+arg2 ... \" Arguments
+.Sh DESCRIPTION \" Section Header - required - don't modify
+Use the .Nm macro to refer to your program throughout the man page like such:
+.Nm
+Underlining is accomplished with the .Ar macro like this:
+.Ar underlined text .
+.Pp \" Inserts a space
+A list of items with descriptions:
+.Bl -tag -width -indent \" Begins a tagged list
+.It item a \" Each item preceded by .It macro
+Description of item a
+.It item b
+Description of item b
+.El \" Ends the list
+.Pp
+A list of flags and their descriptions:
+.Bl -tag -width -indent \" Differs from above in tag removed
+.It Fl a \"-a flag as a list item
+Description of -a flag
+.It Fl b
+Description of -b flag
+.El \" Ends the list
+.Pp
+.\" .Sh ENVIRONMENT \" May not be needed
+.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
+.\" .It Ev ENV_VAR_1
+.\" Description of ENV_VAR_1
+.\" .It Ev ENV_VAR_2
+.\" Description of ENV_VAR_2
+.\" .El
+.Sh FILES \" File used or created by the topic of the man page
+.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
+.It Pa /usr/share/file_name
+FILE_1 description
+.It Pa /Users/joeuser/Library/really_long_file_name
+FILE_2 description
+.El \" Ends the list
+.\" .Sh DIAGNOSTICS \" May not be needed
+.\" .Bl -diag
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .El
+.Sh SEE ALSO
+.\" List links in ascending order by section, alphabetically within a section.
+.\" Please do not reference files that do not exist without filing a bug report
+.Xr a 1 ,
+.Xr b 1 ,
+.Xr c 1 ,
+.Xr a 2 ,
+.Xr b 2 ,
+.Xr a 3 ,
+.Xr b 3
+.\" .Sh BUGS \" Document known, unremedied bugs
.\" .Sh HISTORY \" Document history if command behaves in a unique manner
\ No newline at end of file
diff --git a/projects/XCode4/OCTest/OCTest/OCTest.1 b/projects/XCode4/OCTest/OCTest/OCTest.1
index 6ab5ed69..7915d02a 100644
--- a/projects/XCode4/OCTest/OCTest/OCTest.1
+++ b/projects/XCode4/OCTest/OCTest/OCTest.1
@@ -1,79 +1,79 @@
-.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
-.\"See Also:
-.\"man mdoc.samples for a complete listing of options
-.\"man mdoc for the short list of editing options
-.\"/usr/share/misc/mdoc.template
-.Dd 09/02/2012 \" DATE
-.Dt OCTest 1 \" Program name and manual section number
-.Os Darwin
-.Sh NAME \" Section Header - required - don't modify
-.Nm OCTest,
-.\" The following lines are read in generating the apropos(man -k) database. Use only key
-.\" words here as the database is built based on the words here and in the .ND line.
-.Nm Other_name_for_same_program(),
-.Nm Yet another name for the same program.
-.\" Use .Nm macro to designate other names for the documented program.
-.Nd This line parsed for whatis database.
-.Sh SYNOPSIS \" Section Header - required - don't modify
-.Nm
-.Op Fl abcd \" [-abcd]
-.Op Fl a Ar path \" [-a path]
-.Op Ar file \" [file]
-.Op Ar \" [file ...]
-.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
-arg2 ... \" Arguments
-.Sh DESCRIPTION \" Section Header - required - don't modify
-Use the .Nm macro to refer to your program throughout the man page like such:
-.Nm
-Underlining is accomplished with the .Ar macro like this:
-.Ar underlined text .
-.Pp \" Inserts a space
-A list of items with descriptions:
-.Bl -tag -width -indent \" Begins a tagged list
-.It item a \" Each item preceded by .It macro
-Description of item a
-.It item b
-Description of item b
-.El \" Ends the list
-.Pp
-A list of flags and their descriptions:
-.Bl -tag -width -indent \" Differs from above in tag removed
-.It Fl a \"-a flag as a list item
-Description of -a flag
-.It Fl b
-Description of -b flag
-.El \" Ends the list
-.Pp
-.\" .Sh ENVIRONMENT \" May not be needed
-.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
-.\" .It Ev ENV_VAR_1
-.\" Description of ENV_VAR_1
-.\" .It Ev ENV_VAR_2
-.\" Description of ENV_VAR_2
-.\" .El
-.Sh FILES \" File used or created by the topic of the man page
-.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
-.It Pa /usr/share/file_name
-FILE_1 description
-.It Pa /Users/joeuser/Library/really_long_file_name
-FILE_2 description
-.El \" Ends the list
-.\" .Sh DIAGNOSTICS \" May not be needed
-.\" .Bl -diag
-.\" .It Diagnostic Tag
-.\" Diagnostic informtion here.
-.\" .It Diagnostic Tag
-.\" Diagnostic informtion here.
-.\" .El
-.Sh SEE ALSO
-.\" List links in ascending order by section, alphabetically within a section.
-.\" Please do not reference files that do not exist without filing a bug report
-.Xr a 1 ,
-.Xr b 1 ,
-.Xr c 1 ,
-.Xr a 2 ,
-.Xr b 2 ,
-.Xr a 3 ,
-.Xr b 3
-.\" .Sh BUGS \" Document known, unremedied bugs
+.\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
+.\"See Also:
+.\"man mdoc.samples for a complete listing of options
+.\"man mdoc for the short list of editing options
+.\"/usr/share/misc/mdoc.template
+.Dd 09/02/2012 \" DATE
+.Dt OCTest 1 \" Program name and manual section number
+.Os Darwin
+.Sh NAME \" Section Header - required - don't modify
+.Nm OCTest,
+.\" The following lines are read in generating the apropos(man -k) database. Use only key
+.\" words here as the database is built based on the words here and in the .ND line.
+.Nm Other_name_for_same_program(),
+.Nm Yet another name for the same program.
+.\" Use .Nm macro to designate other names for the documented program.
+.Nd This line parsed for whatis database.
+.Sh SYNOPSIS \" Section Header - required - don't modify
+.Nm
+.Op Fl abcd \" [-abcd]
+.Op Fl a Ar path \" [-a path]
+.Op Ar file \" [file]
+.Op Ar \" [file ...]
+.Ar arg0 \" Underlined argument - use .Ar anywhere to underline
+arg2 ... \" Arguments
+.Sh DESCRIPTION \" Section Header - required - don't modify
+Use the .Nm macro to refer to your program throughout the man page like such:
+.Nm
+Underlining is accomplished with the .Ar macro like this:
+.Ar underlined text .
+.Pp \" Inserts a space
+A list of items with descriptions:
+.Bl -tag -width -indent \" Begins a tagged list
+.It item a \" Each item preceded by .It macro
+Description of item a
+.It item b
+Description of item b
+.El \" Ends the list
+.Pp
+A list of flags and their descriptions:
+.Bl -tag -width -indent \" Differs from above in tag removed
+.It Fl a \"-a flag as a list item
+Description of -a flag
+.It Fl b
+Description of -b flag
+.El \" Ends the list
+.Pp
+.\" .Sh ENVIRONMENT \" May not be needed
+.\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
+.\" .It Ev ENV_VAR_1
+.\" Description of ENV_VAR_1
+.\" .It Ev ENV_VAR_2
+.\" Description of ENV_VAR_2
+.\" .El
+.Sh FILES \" File used or created by the topic of the man page
+.Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
+.It Pa /usr/share/file_name
+FILE_1 description
+.It Pa /Users/joeuser/Library/really_long_file_name
+FILE_2 description
+.El \" Ends the list
+.\" .Sh DIAGNOSTICS \" May not be needed
+.\" .Bl -diag
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .It Diagnostic Tag
+.\" Diagnostic informtion here.
+.\" .El
+.Sh SEE ALSO
+.\" List links in ascending order by section, alphabetically within a section.
+.\" Please do not reference files that do not exist without filing a bug report
+.Xr a 1 ,
+.Xr b 1 ,
+.Xr c 1 ,
+.Xr a 2 ,
+.Xr b 2 ,
+.Xr a 3 ,
+.Xr b 3
+.\" .Sh BUGS \" Document known, unremedied bugs
.\" .Sh HISTORY \" Document history if command behaves in a unique manner
\ No newline at end of file
From 11ba37713490fe6f2a8ba20b4d467a30d37973f6 Mon Sep 17 00:00:00 2001
From: Phil Nash
Date: Sat, 9 Nov 2013 07:43:20 +0000
Subject: [PATCH 05/21] Change one more in-page link to work with GitHub
generated anchors
---
docs/tutorial.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/tutorial.md b/docs/tutorial.md
index 12f838d9..058167d4 100644
--- a/docs/tutorial.md
+++ b/docs/tutorial.md
@@ -87,11 +87,11 @@ Of course there are still more issues to do deal with. For example we'll hit pro
Although this was a simple test it's been enough to demonstrate a few things about how Catch is used. Let's take moment to consider those before we move on.
1. All we did was ```#define``` one identifier and ```#include``` one header and we got everything - even an implementation of ```main()``` that will [respond to command line arguments](command-line.md). You can only use that ```#define``` in one implementation file, for (hopefully) obvious reasons. Once you have more than one file with unit tests in you'll just ```#include "catch.hpp"``` and go. Usually it's a good idea to have a dedicated implementation file that just has ```#define CATCH_CONFIG_MAIN``` and ```#include "catch.hpp"```. You can also provide your own implementation of main and drive Catch yourself (see [Supplying-your-own-main()](own-main.md).
-2. We introduce test cases with the TEST_CASE macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see Test cases and Sections, below. The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md) for more information on running tests.
+2. We introduce test cases with the TEST_CASE macro. This macro takes one or two arguments - a free form test name and, optionally, one or more tags (for more see Test cases and Sections, below. The test name must be unique. You can run sets of tests by specifying a wildcarded test name or a tag expression. See the [command line docs](command-line.md) for more information on running tests.
3. The name and tags arguments are just strings. We haven't had to declare a function or method - or explicitly register the test case anywhere. Behind the scenes a function with a generated name is defined for you, and automatically registered using static registry classes. By abstracting the function name away we can name our tests without the constraints of identifier names.
4. We write our individual test assertions using the REQUIRE macro. Rather than a separate macro for each type of condition we express the condition naturally using C/C++ syntax. Behind the scenes a simple set of expression templates captures the left-hand-side and right-hand-side of the expression so we can display the values in our test report. As we'll see later there _are_ other assertion macros - but because of this technique the number of them is drastically reduced.
-
+
## Test cases and sections
Most test frameworks have a class-based fixture mechanism. That is, test cases map to methods on a class and common setup and teardown can be performed in ```setup()``` and ```teardown()``` methods (or constructor/ destructor in languages, like C++, that support deterministic destruction).
From 5320518dbc3f22909b24f182ce2e463e6fc80abc Mon Sep 17 00:00:00 2001
From: Phil Nash
Date: Sat, 9 Nov 2013 07:47:09 +0000
Subject: [PATCH 06/21] Build 12
---
README.md | 2 +-
include/internal/catch_version.hpp | 2 +-
single_include/catch.hpp | 12 +++++++-----
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 5efeaddd..7ca7994b 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
![catch logo](catch-logo-small.png)
-*v1.0 build 11 (master branch)*
+*v1.0 build 12 (master branch)*
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)
diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp
index 4b021717..68912715 100644
--- a/include/internal/catch_version.hpp
+++ b/include/internal/catch_version.hpp
@@ -13,7 +13,7 @@
namespace Catch {
// These numbers are maintained by a script
- Version libraryVersion( 1, 0, 11, "master" );
+ Version libraryVersion( 1, 0, 12, "master" );
}
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED
diff --git a/single_include/catch.hpp b/single_include/catch.hpp
index 9aab75a3..dedb9363 100644
--- a/single_include/catch.hpp
+++ b/single_include/catch.hpp
@@ -1,6 +1,6 @@
/*
- * CATCH v1.0 build 11 (master branch)
- * Generated: 2013-10-23 15:34:32.120349
+ * CATCH v1.0 build 12 (master branch)
+ * Generated: 2013-11-09 07:46:33.549497
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -595,6 +595,7 @@ namespace Catch {
#include
#include
#include
+#include
#ifdef __OBJC__
// #included from: catch_objc_arc.hpp
@@ -4629,12 +4630,13 @@ namespace Catch {
std::cout << nameCol;
}
if( i < tagsWrapper.size() && !tagsWrapper[i].empty() ) {
+ size_t padLen( maxNameLen > nameCol.size() ? maxNameLen - nameCol.size() : 0 );
if( i == 0 ) {
Colour colourGuard( Colour::SecondaryText );
- std::cout << " " << std::string( maxNameLen - nameCol.size(), '.' ) << " ";
+ std::cout << " " << std::string( padLen, '.' ) << " ";
}
else {
- std::cout << std::string( maxNameLen - nameCol.size(), ' ' ) << " ";
+ std::cout << std::string( padLen, ' ' ) << " ";
}
std::cout << tagsWrapper[i];
}
@@ -6371,7 +6373,7 @@ namespace Catch {
namespace Catch {
// These numbers are maintained by a script
- Version libraryVersion( 1, 0, 11, "master" );
+ Version libraryVersion( 1, 0, 12, "master" );
}
// #included from: catch_text.hpp
From ecb94327634e82ba06d1455dfd713681efd186b5 Mon Sep 17 00:00:00 2001
From: Phil Nash
Date: Tue, 12 Nov 2013 18:59:34 +0000
Subject: [PATCH 07/21] Simplified and tidied test case and tag listing
---
include/internal/catch_list.hpp | 116 +++++++++-----------------------
1 file changed, 30 insertions(+), 86 deletions(-)
diff --git a/include/internal/catch_list.hpp b/include/internal/catch_list.hpp
index 45807edd..a0b0ac4e 100644
--- a/include/internal/catch_list.hpp
+++ b/include/internal/catch_list.hpp
@@ -30,76 +30,29 @@ namespace Catch {
std::cout << "All available test cases:\n";
else
std::cout << "Matching test cases:\n";
- std::vector const& allTests = getRegistryHub().getTestCaseRegistry().getAllTests();
- std::vector::const_iterator it = allTests.begin(), itEnd = allTests.end();
-
- // First pass - get max tags
- std::size_t maxTagLen = 0;
- std::size_t maxNameLen = 0;
- for(; it != itEnd; ++it ) {
- if( matchesFilters( config.filters(), *it ) ) {
- maxTagLen = (std::max)( it->getTestCaseInfo().tagsAsString.size(), maxTagLen );
- maxNameLen = (std::max)( it->getTestCaseInfo().name.size(), maxNameLen );
- }
- }
-
- // Try to fit everything in. If not shrink tag column first, down to 30
- // then shrink name column until it all fits (strings will be wrapped within column)
- while( maxTagLen + maxNameLen > CATCH_CONFIG_CONSOLE_WIDTH-5 ) {
- if( maxTagLen > 30 )
- --maxTagLen;
- else
- --maxNameLen;
- }
std::size_t matchedTests = 0;
- for( it = allTests.begin(); it != itEnd; ++it ) {
+ TextAttributes nameAttr, tagsAttr;
+ nameAttr.setInitialIndent( 2 ).setIndent( 4 );
+ tagsAttr.setIndent( 6 );
+
+ std::vector const& allTests = getRegistryHub().getTestCaseRegistry().getAllTests();
+ for( std::vector::const_iterator it = allTests.begin(), itEnd = allTests.end();
+ it != itEnd;
+ ++it )
if( matchesFilters( config.filters(), *it ) ) {
matchedTests++;
- Text nameWrapper( it->getTestCaseInfo().name,
- TextAttributes()
- .setWidth( maxNameLen+2 )
- .setInitialIndent(2)
- .setIndent(4) );
+ TestCaseInfo const& testCaseInfo = it->getTestCaseInfo();
+ Colour::Code colour = testCaseInfo.isHidden
+ ? Colour::SecondaryText
+ : Colour::None;
+ Colour colourGuard( colour );
- Text tagsWrapper( it->getTestCaseInfo().tagsAsString,
- TextAttributes()
- .setWidth( maxTagLen )
- .setInitialIndent(0)
- .setIndent( 2 ) );
-
- for( std::size_t i = 0; i < (std::max)( nameWrapper.size(), tagsWrapper.size() ); ++i ) {
- Colour::Code colour = Colour::None;
- if( it->getTestCaseInfo().isHidden )
- colour = Colour::SecondaryText;
- std::string nameCol;
- if( i < nameWrapper.size() ) {
- nameCol = nameWrapper[i];
- }
- else {
- nameCol = " ...";
- colour = Colour::SecondaryText;
- }
-
- {
- Colour colourGuard( colour );
- std::cout << nameCol;
- }
- if( i < tagsWrapper.size() && !tagsWrapper[i].empty() ) {
- size_t padLen( maxNameLen > nameCol.size() ? maxNameLen - nameCol.size() : 0 );
- if( i == 0 ) {
- Colour colourGuard( Colour::SecondaryText );
- std::cout << " " << std::string( padLen, '.' ) << " ";
- }
- else {
- std::cout << std::string( padLen, ' ' ) << " ";
- }
- std::cout << tagsWrapper[i];
- }
- std::cout << "\n";
- }
+ std::cout << Text( testCaseInfo.name, nameAttr ) << std::endl;
+ if( !testCaseInfo.tags.empty() )
+ std::cout << Text( testCaseInfo.tagsAsString, tagsAttr ) << std::endl;
}
- }
+
if( config.filters().empty() )
std::cout << pluralise( matchedTests, "test case" ) << "\n" << std::endl;
else
@@ -112,21 +65,20 @@ namespace Catch {
std::cout << "All available tags:\n";
else
std::cout << "Matching tags:\n";
- std::vector const& allTests = getRegistryHub().getTestCaseRegistry().getAllTests();
- std::vector::const_iterator it = allTests.begin(), itEnd = allTests.end();
std::map tagCounts;
- std::size_t maxTagLen = 0;
-
- for(; it != itEnd; ++it ) {
+ std::vector const& allTests = getRegistryHub().getTestCaseRegistry().getAllTests();
+ for( std::vector::const_iterator it = allTests.begin(),
+ itEnd = allTests.end();
+ it != itEnd;
+ ++it ) {
if( matchesFilters( config.filters(), *it ) ) {
for( std::set::const_iterator tagIt = it->getTestCaseInfo().tags.begin(),
tagItEnd = it->getTestCaseInfo().tags.end();
tagIt != tagItEnd;
++tagIt ) {
std::string tagName = *tagIt;
- maxTagLen = (std::max)( maxTagLen, tagName.size() );
std::map::iterator countIt = tagCounts.find( tagName );
if( countIt == tagCounts.end() )
tagCounts.insert( std::make_pair( tagName, 1 ) );
@@ -135,26 +87,18 @@ namespace Catch {
}
}
}
- maxTagLen +=4;
- if( maxTagLen > CATCH_CONFIG_CONSOLE_WIDTH-10 )
- maxTagLen = CATCH_CONFIG_CONSOLE_WIDTH-10;
- for( std::map::const_iterator countIt = tagCounts.begin(), countItEnd = tagCounts.end();
+ for( std::map::const_iterator countIt = tagCounts.begin(),
+ countItEnd = tagCounts.end();
countIt != countItEnd;
++countIt ) {
+ std::ostringstream oss;
+ oss << " " << countIt->second << " ";
Text wrapper( "[" + countIt->first + "]", TextAttributes()
- .setIndent(2)
- .setWidth( maxTagLen ) );
- std::cout << wrapper;
- std::size_t dots = 2;
- if( maxTagLen > wrapper.last().size() )
- dots += maxTagLen - wrapper.last().size();
- {
- Colour colourGuard( Colour::SecondaryText );
- std::cout << std::string( dots, '.' );
- }
- std::cout << countIt->second
- << "\n";
+ .setInitialIndent( 0 )
+ .setIndent( oss.str().size() )
+ .setWidth( CATCH_CONFIG_CONSOLE_WIDTH-10 ) );
+ std::cout << oss.str() << wrapper << "\n";
}
std::cout << pluralise( tagCounts.size(), "tag" ) << "\n" << std::endl;
return tagCounts.size();
From 2f086ae25542a06f55bab3d217917c7d885282f6 Mon Sep 17 00:00:00 2001
From: Phil Nash
Date: Tue, 12 Nov 2013 19:06:08 +0000
Subject: [PATCH 08/21] If no assertions print custom message
---
include/reporters/catch_reporter_console.hpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index 816f4214..7d9ec684 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -315,9 +315,14 @@ namespace Catch {
}
void printTotals( const Totals& totals ) {
- if( totals.assertions.total() == 0 ) {
+ if( totals.testCases.total() == 0 ) {
stream << "No tests ran";
}
+ else if( totals.assertions.total() == 0 ) {
+ Colour colour( Colour::Yellow );
+ printCounts( "test case", totals.testCases );
+ stream << " (no assertions)";
+ }
else if( totals.assertions.failed ) {
Colour colour( Colour::ResultError );
printCounts( "test case", totals.testCases );
From 4f57c8c589a1ffffc142960fe79fa6e5b74a1047 Mon Sep 17 00:00:00 2001
From: Phil Nash
Date: Wed, 13 Nov 2013 08:07:38 +0000
Subject: [PATCH 09/21] Print warnings if no assertions and not running with -s
---
include/reporters/catch_reporter_console.hpp | 21 +++++++---
.../Baselines/console.std.approved.txt | 42 +++++++++++++++++++
2 files changed, 57 insertions(+), 6 deletions(-)
diff --git a/include/reporters/catch_reporter_console.hpp b/include/reporters/catch_reporter_console.hpp
index 7d9ec684..17b07a7f 100644
--- a/include/reporters/catch_reporter_console.hpp
+++ b/include/reporters/catch_reporter_console.hpp
@@ -41,13 +41,18 @@ namespace Catch {
virtual bool assertionEnded( AssertionStats const& _assertionStats ) {
AssertionResult const& result = _assertionStats.assertionResult;
+ bool printInfoMessages = true;
+
// Drop out if result was successful and we're not printing those
- if( !m_config->includeSuccessfulResults() && result.isOk() )
- return false;
+ if( !m_config->includeSuccessfulResults() && result.isOk() ) {
+ if( result.getResultType() != ResultWas::Warning )
+ return false;
+ printInfoMessages = false;
+ }
lazyPrint();
- AssertionPrinter printer( stream, _assertionStats );
+ AssertionPrinter printer( stream, _assertionStats, printInfoMessages );
printer.print();
stream << std::endl;
return true;
@@ -105,13 +110,14 @@ namespace Catch {
class AssertionPrinter {
void operator= ( AssertionPrinter const& );
public:
- AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats )
+ AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages )
: stream( _stream ),
stats( _stats ),
result( _stats.assertionResult ),
colour( Colour::None ),
message( result.getMessage() ),
- messages( _stats.infoMessages )
+ messages( _stats.infoMessages ),
+ printInfoMessages( _printInfoMessages )
{
switch( result.getResultType() ) {
case ResultWas::Ok:
@@ -214,7 +220,9 @@ namespace Catch {
for( std::vector::const_iterator it = messages.begin(), itEnd = messages.end();
it != itEnd;
++it ) {
- stream << Text( it->message, TextAttributes().setIndent(2) ) << "\n";
+ // If this assertion is a warning ignore any INFO messages
+ if( printInfoMessages || it->type != ResultWas::Info )
+ stream << Text( it->message, TextAttributes().setIndent(2) ) << "\n";
}
}
void printSourceInfo() const {
@@ -230,6 +238,7 @@ namespace Catch {
std::string messageLabel;
std::string message;
std::vector messages;
+ bool printInfoMessages;
};
void lazyPrint() {
diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt
index feb08934..aaafd844 100644
--- a/projects/SelfTest/Baselines/console.std.approved.txt
+++ b/projects/SelfTest/Baselines/console.std.approved.txt
@@ -373,6 +373,16 @@ ExceptionTests.cpp:: FAILED:
due to unexpected exception with message:
3.14
+-------------------------------------------------------------------------------
+./succeeding/message
+-------------------------------------------------------------------------------
+MessageTests.cpp:
+...............................................................................
+
+MessageTests.cpp::
+warning:
+ this is a warning
+
-------------------------------------------------------------------------------
./failing/message/info/1
-------------------------------------------------------------------------------
@@ -640,6 +650,16 @@ MiscTests.cpp:: FAILED:
with expansion:
"this string contains 'abc' as a substring" equals: "something else"
+-------------------------------------------------------------------------------
+Nice descriptive name
+-------------------------------------------------------------------------------
+MiscTests.cpp:
+...............................................................................
+
+MiscTests.cpp::
+warning:
+ This one ran
+
-------------------------------------------------------------------------------
./failing/CatchSectionInfiniteLoop
-------------------------------------------------------------------------------
@@ -680,6 +700,28 @@ Some information
An error
hello
hello
+-------------------------------------------------------------------------------
+./inprogress/failing/Tricky/trailing expression
+-------------------------------------------------------------------------------
+TrickyTests.cpp:
+...............................................................................
+
+TrickyTests.cpp::
+warning:
+ Uncomment the code in this test to check that it gives a sensible compiler
+ error
+
+-------------------------------------------------------------------------------
+./inprogress/failing/Tricky/compound lhs
+-------------------------------------------------------------------------------
+TrickyTests.cpp:
+...............................................................................
+
+TrickyTests.cpp::
+warning:
+ Uncomment the code in this test to check that it gives a sensible compiler
+ error
+
-------------------------------------------------------------------------------
./failing/Tricky/non streamable type
-------------------------------------------------------------------------------
From 8d44f2dbb2820ca3596cb0e2c049562f3f2ad285 Mon Sep 17 00:00:00 2001
From: Phil Nash
Date: Wed, 13 Nov 2013 08:10:45 +0000
Subject: [PATCH 10/21] build 13
---
README.md | 2 +-
include/internal/catch_version.hpp | 2 +-
single_include/catch.hpp | 150 +++++++++++------------------
3 files changed, 56 insertions(+), 98 deletions(-)
diff --git a/README.md b/README.md
index 7ca7994b..3579e112 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
![catch logo](catch-logo-small.png)
-*v1.0 build 12 (master branch)*
+*v1.0 build 13 (master branch)*
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)
diff --git a/include/internal/catch_version.hpp b/include/internal/catch_version.hpp
index 68912715..89b4e04f 100644
--- a/include/internal/catch_version.hpp
+++ b/include/internal/catch_version.hpp
@@ -13,7 +13,7 @@
namespace Catch {
// These numbers are maintained by a script
- Version libraryVersion( 1, 0, 12, "master" );
+ Version libraryVersion( 1, 0, 13, "master" );
}
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED
diff --git a/single_include/catch.hpp b/single_include/catch.hpp
index dedb9363..2fc6b728 100644
--- a/single_include/catch.hpp
+++ b/single_include/catch.hpp
@@ -1,6 +1,6 @@
/*
- * CATCH v1.0 build 12 (master branch)
- * Generated: 2013-11-09 07:46:33.549497
+ * CATCH v1.0 build 13 (master branch)
+ * Generated: 2013-11-13 08:10:05.836093
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -4574,76 +4574,29 @@ namespace Catch {
std::cout << "All available test cases:\n";
else
std::cout << "Matching test cases:\n";
- std::vector const& allTests = getRegistryHub().getTestCaseRegistry().getAllTests();
- std::vector::const_iterator it = allTests.begin(), itEnd = allTests.end();
-
- // First pass - get max tags
- std::size_t maxTagLen = 0;
- std::size_t maxNameLen = 0;
- for(; it != itEnd; ++it ) {
- if( matchesFilters( config.filters(), *it ) ) {
- maxTagLen = (std::max)( it->getTestCaseInfo().tagsAsString.size(), maxTagLen );
- maxNameLen = (std::max)( it->getTestCaseInfo().name.size(), maxNameLen );
- }
- }
-
- // Try to fit everything in. If not shrink tag column first, down to 30
- // then shrink name column until it all fits (strings will be wrapped within column)
- while( maxTagLen + maxNameLen > CATCH_CONFIG_CONSOLE_WIDTH-5 ) {
- if( maxTagLen > 30 )
- --maxTagLen;
- else
- --maxNameLen;
- }
std::size_t matchedTests = 0;
- for( it = allTests.begin(); it != itEnd; ++it ) {
+ TextAttributes nameAttr, tagsAttr;
+ nameAttr.setInitialIndent( 2 ).setIndent( 4 );
+ tagsAttr.setIndent( 6 );
+
+ std::vector const& allTests = getRegistryHub().getTestCaseRegistry().getAllTests();
+ for( std::vector::const_iterator it = allTests.begin(), itEnd = allTests.end();
+ it != itEnd;
+ ++it )
if( matchesFilters( config.filters(), *it ) ) {
matchedTests++;
- Text nameWrapper( it->getTestCaseInfo().name,
- TextAttributes()
- .setWidth( maxNameLen+2 )
- .setInitialIndent(2)
- .setIndent(4) );
+ TestCaseInfo const& testCaseInfo = it->getTestCaseInfo();
+ Colour::Code colour = testCaseInfo.isHidden
+ ? Colour::SecondaryText
+ : Colour::None;
+ Colour colourGuard( colour );
- Text tagsWrapper( it->getTestCaseInfo().tagsAsString,
- TextAttributes()
- .setWidth( maxTagLen )
- .setInitialIndent(0)
- .setIndent( 2 ) );
-
- for( std::size_t i = 0; i < (std::max)( nameWrapper.size(), tagsWrapper.size() ); ++i ) {
- Colour::Code colour = Colour::None;
- if( it->getTestCaseInfo().isHidden )
- colour = Colour::SecondaryText;
- std::string nameCol;
- if( i < nameWrapper.size() ) {
- nameCol = nameWrapper[i];
- }
- else {
- nameCol = " ...";
- colour = Colour::SecondaryText;
- }
-
- {
- Colour colourGuard( colour );
- std::cout << nameCol;
- }
- if( i < tagsWrapper.size() && !tagsWrapper[i].empty() ) {
- size_t padLen( maxNameLen > nameCol.size() ? maxNameLen - nameCol.size() : 0 );
- if( i == 0 ) {
- Colour colourGuard( Colour::SecondaryText );
- std::cout << " " << std::string( padLen, '.' ) << " ";
- }
- else {
- std::cout << std::string( padLen, ' ' ) << " ";
- }
- std::cout << tagsWrapper[i];
- }
- std::cout << "\n";
- }
+ std::cout << Text( testCaseInfo.name, nameAttr ) << std::endl;
+ if( !testCaseInfo.tags.empty() )
+ std::cout << Text( testCaseInfo.tagsAsString, tagsAttr ) << std::endl;
}
- }
+
if( config.filters().empty() )
std::cout << pluralise( matchedTests, "test case" ) << "\n" << std::endl;
else
@@ -4656,21 +4609,20 @@ namespace Catch {
std::cout << "All available tags:\n";
else
std::cout << "Matching tags:\n";
- std::vector const& allTests = getRegistryHub().getTestCaseRegistry().getAllTests();
- std::vector::const_iterator it = allTests.begin(), itEnd = allTests.end();
std::map tagCounts;
- std::size_t maxTagLen = 0;
-
- for(; it != itEnd; ++it ) {
+ std::vector const& allTests = getRegistryHub().getTestCaseRegistry().getAllTests();
+ for( std::vector::const_iterator it = allTests.begin(),
+ itEnd = allTests.end();
+ it != itEnd;
+ ++it ) {
if( matchesFilters( config.filters(), *it ) ) {
for( std::set::const_iterator tagIt = it->getTestCaseInfo().tags.begin(),
tagItEnd = it->getTestCaseInfo().tags.end();
tagIt != tagItEnd;
++tagIt ) {
std::string tagName = *tagIt;
- maxTagLen = (std::max)( maxTagLen, tagName.size() );
std::map::iterator countIt = tagCounts.find( tagName );
if( countIt == tagCounts.end() )
tagCounts.insert( std::make_pair( tagName, 1 ) );
@@ -4679,26 +4631,18 @@ namespace Catch {
}
}
}
- maxTagLen +=4;
- if( maxTagLen > CATCH_CONFIG_CONSOLE_WIDTH-10 )
- maxTagLen = CATCH_CONFIG_CONSOLE_WIDTH-10;
- for( std::map::const_iterator countIt = tagCounts.begin(), countItEnd = tagCounts.end();
+ for( std::map::const_iterator countIt = tagCounts.begin(),
+ countItEnd = tagCounts.end();
countIt != countItEnd;
++countIt ) {
+ std::ostringstream oss;
+ oss << " " << countIt->second << " ";
Text wrapper( "[" + countIt->first + "]", TextAttributes()
- .setIndent(2)
- .setWidth( maxTagLen ) );
- std::cout << wrapper;
- std::size_t dots = 2;
- if( maxTagLen > wrapper.last().size() )
- dots += maxTagLen - wrapper.last().size();
- {
- Colour colourGuard( Colour::SecondaryText );
- std::cout << std::string( dots, '.' );
- }
- std::cout << countIt->second
- << "\n";
+ .setInitialIndent( 0 )
+ .setIndent( oss.str().size() )
+ .setWidth( CATCH_CONFIG_CONSOLE_WIDTH-10 ) );
+ std::cout << oss.str() << wrapper << "\n";
}
std::cout << pluralise( tagCounts.size(), "tag" ) << "\n" << std::endl;
return tagCounts.size();
@@ -6373,7 +6317,7 @@ namespace Catch {
namespace Catch {
// These numbers are maintained by a script
- Version libraryVersion( 1, 0, 12, "master" );
+ Version libraryVersion( 1, 0, 13, "master" );
}
// #included from: catch_text.hpp
@@ -7296,13 +7240,18 @@ namespace Catch {
virtual bool assertionEnded( AssertionStats const& _assertionStats ) {
AssertionResult const& result = _assertionStats.assertionResult;
+ bool printInfoMessages = true;
+
// Drop out if result was successful and we're not printing those
- if( !m_config->includeSuccessfulResults() && result.isOk() )
- return false;
+ if( !m_config->includeSuccessfulResults() && result.isOk() ) {
+ if( result.getResultType() != ResultWas::Warning )
+ return false;
+ printInfoMessages = false;
+ }
lazyPrint();
- AssertionPrinter printer( stream, _assertionStats );
+ AssertionPrinter printer( stream, _assertionStats, printInfoMessages );
printer.print();
stream << std::endl;
return true;
@@ -7360,13 +7309,14 @@ namespace Catch {
class AssertionPrinter {
void operator= ( AssertionPrinter const& );
public:
- AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats )
+ AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages )
: stream( _stream ),
stats( _stats ),
result( _stats.assertionResult ),
colour( Colour::None ),
message( result.getMessage() ),
- messages( _stats.infoMessages )
+ messages( _stats.infoMessages ),
+ printInfoMessages( _printInfoMessages )
{
switch( result.getResultType() ) {
case ResultWas::Ok:
@@ -7469,7 +7419,9 @@ namespace Catch {
for( std::vector::const_iterator it = messages.begin(), itEnd = messages.end();
it != itEnd;
++it ) {
- stream << Text( it->message, TextAttributes().setIndent(2) ) << "\n";
+ // If this assertion is a warning ignore any INFO messages
+ if( printInfoMessages || it->type != ResultWas::Info )
+ stream << Text( it->message, TextAttributes().setIndent(2) ) << "\n";
}
}
void printSourceInfo() const {
@@ -7485,6 +7437,7 @@ namespace Catch {
std::string messageLabel;
std::string message;
std::vector messages;
+ bool printInfoMessages;
};
void lazyPrint() {
@@ -7570,9 +7523,14 @@ namespace Catch {
}
void printTotals( const Totals& totals ) {
- if( totals.assertions.total() == 0 ) {
+ if( totals.testCases.total() == 0 ) {
stream << "No tests ran";
}
+ else if( totals.assertions.total() == 0 ) {
+ Colour colour( Colour::Yellow );
+ printCounts( "test case", totals.testCases );
+ stream << " (no assertions)";
+ }
else if( totals.assertions.failed ) {
Colour colour( Colour::ResultError );
printCounts( "test case", totals.testCases );
From f15b74c0d224c1b89fb2348b1c596227303f30c1 Mon Sep 17 00:00:00 2001
From: Phil Nash
Date: Thu, 14 Nov 2013 19:08:19 +0000
Subject: [PATCH 11/21] Added some more docs
---
docs/command-line.md | 2 +-
docs/test-cases-and-sections.md | 17 +++++++-
docs/tutorial.md | 77 ++++++++++++++++++++++++++++++++-
3 files changed, 93 insertions(+), 3 deletions(-)
diff --git a/docs/command-line.md b/docs/command-line.md
index b94dc86f..915286c8 100644
--- a/docs/command-line.md
+++ b/docs/command-line.md
@@ -21,7 +21,7 @@ Note that options are described according to the following pattern:
Test cases, wildcarded test cases, tags and tag expressions are all passed directly as arguments. Tags are distinguished by being enclosed in square brackets.
-If no test specs are supplied then all test cases, except "hidden" tests (tagged ```[hide]``` or, in the legacy case, prefixed by `'./'`) are run
+If no test specs are supplied then all test cases, except "hidden" tests (tagged ```[hide]```, ```[.]``` or, in the legacy case, prefixed by `'./'`) are run.
Specs must be enclosed in quotes if they contain spaces. If they do not contain spaces the quotes are optional.
diff --git a/docs/test-cases-and-sections.md b/docs/test-cases-and-sections.md
index 4fc3f6f8..863d5faf 100644
--- a/docs/test-cases-and-sections.md
+++ b/docs/test-cases-and-sections.md
@@ -15,7 +15,22 @@ For examples see the [Tutorial](tutorial.md)
## Tags
--{placeholder for documentation of tags}-
+Tags allow an arbitrary number of additional strings to be associated with a test case. Test cases can be selected (for running, or just for listing) by tag - or even by an expression that combines several tags. At their most basic level they provide a simple way to group several related tests together.
+
+As an example - given the following test cases:
+
+ TEST_CASE( "A", "[widget]" ) { /* ... */ }
+ TEST_CASE( "B", "[widget]" ) { /* ... */ }
+ TEST_CASE( "C", "[gadget]" ) { /* ... */ }
+ TEST_CASE( "D", "[widget][gadget]" ) { /* ... */ }
+
+The tag expression, ```"[widget]"``` selects A, B & D. ```"[gadget]"``` selects C & D. ```"[widget][gadget]"``` selects just D and ```"[widget],[gadget]"``` selects all four test cases.
+
+For more detail on command line selection see [the command line docs](command-line.md#specifying-which-tests-to-run)
+
+A special tag name, ```[hide]``` causes test cases to be skipped from the default list (ie when no test cases have been explicitly selected through tag expressions or name wildcards). ```[.]``` is an alias for ```[hide]```.
+
+Tag names are not case sensitive.
## BDD-style test cases
diff --git a/docs/tutorial.md b/docs/tutorial.md
index 058167d4..2d75dab0 100644
--- a/docs/tutorial.md
+++ b/docs/tutorial.md
@@ -140,7 +140,82 @@ This works because the ```SECTION``` macro contains an if statement that calls b
So far so good - this is already an improvement on the setup/ teardown approach because now we see our setup code inline and we can use the stack.
--{placeholder for documentation on nested sections}-
+The power of sections really shows, however, when we need to execute a sequence of, checked, operations. Continuing the vector example we might want to verify that after reserving a larger capacity, if we reserve smaller capacity (but still larger than the current size) then the capacity is not, in fact, changed. We can do that, naturally, like so:
+
+ SECTION( "reserving bigger changes capacity but not size" ) {
+ v.reserve( 10 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 10 );
+
+ SECTION( "reserving smaller again does not change capacity" ) {
+ v.reserve( 7 );
+
+ REQUIRE( v.capacity() >= 10 );
+ }
+ }
+
+Sections can be nested to an arbitrary depth (limited only by your stack size). Each leaf section (i.e. a section that contains no nested sections) will be executed exactly once, on a separate path of execution from any other leaf section (so no leaf section can interfere with another). Obviously a failure in a parent section will prevent nested sections from running - but that's the idea.
+
+## BDD-Style
+
+If you name your test cases and sections appropriately you can achieve a BDD-style specification structure. This became such a useful way of working that first class support has been added to Catch. Scenarios can be specified using ```SCENARIO```, ```GIVEN```, ```WHEN``` and ```THEN``` macros, which map on to ```TEST_CASE```s and ```SECTION```s, respectively (for more details see [Test cases and sections](test-cases-and-sections.md)).
+
+The vector example can be adjusted to use these macros like so:
+
+```c++
+SCENARIO( "vectors can be sized and resized", "[vector]" ) {
+
+ GIVEN( "A vector with some items" ) {
+ std::vector v( 5 );
+
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+
+ WHEN( "the size is increased" ) {
+ v.resize( 10 );
+
+ THEN( "the size and capacity change" ) {
+ REQUIRE( v.size() == 10 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ }
+ WHEN( "the size is reduced" ) {
+ v.resize( 0 );
+
+ THEN( "the size changes but not capacity" ) {
+ REQUIRE( v.size() == 0 );
+ REQUIRE( v.capacity() >= 5 );
+ }
+ }
+ WHEN( "more capacity is reserved" ) {
+ v.reserve( 10 );
+
+ THEN( "the capacity changes but not the size" ) {
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 10 );
+ }
+ }
+ WHEN( "less capacity is reserved" ) {
+ v.reserve( 0 );
+
+ THEN( "neither size nor capacity are changed" ) {
+ REQUIRE( v.size() == 5 );
+ REQUIRE( v.capacity() >= 5 );
+ }
+ }
+ }
+}
+```
+
+A nice consequence of this is that when these tests are run the test names are reported like this:
+
+```
+Scenario: vectors can be sized and resized
+ Given: A vector with some items
+ When: more capacity is reserved
+ Then: the capacity changes but not the size
+```
## Next steps
For more specific information see the [Reference pages](reference-index.md)
From a9fd5b3f14f927f94e7ce84b0f9b5e31b2f44d09 Mon Sep 17 00:00:00 2001
From: Phil Nash
Date: Thu, 14 Nov 2013 23:35:56 +0000
Subject: [PATCH 12/21] Removed cruft from VS projects
---
projects/VS2008/TestCatch/UpgradeLog.XML | 12 -
.../_UpgradeReport_Files/UpgradeReport.css | 207 ----------------
.../_UpgradeReport_Files/UpgradeReport.xslt | 232 ------------------
.../UpgradeReport_Minus.gif | Bin 69 -> 0 bytes
.../UpgradeReport_Plus.gif | Bin 71 -> 0 bytes
.../VS2010/TestCatch/TestCatch/ReadMe.txt | 33 ---
6 files changed, 484 deletions(-)
delete mode 100644 projects/VS2008/TestCatch/UpgradeLog.XML
delete mode 100644 projects/VS2008/TestCatch/_UpgradeReport_Files/UpgradeReport.css
delete mode 100644 projects/VS2008/TestCatch/_UpgradeReport_Files/UpgradeReport.xslt
delete mode 100644 projects/VS2008/TestCatch/_UpgradeReport_Files/UpgradeReport_Minus.gif
delete mode 100644 projects/VS2008/TestCatch/_UpgradeReport_Files/UpgradeReport_Plus.gif
delete mode 100644 projects/VS2010/TestCatch/TestCatch/ReadMe.txt
diff --git a/projects/VS2008/TestCatch/UpgradeLog.XML b/projects/VS2008/TestCatch/UpgradeLog.XML
deleted file mode 100644
index 991a3e5b..00000000
--- a/projects/VS2008/TestCatch/UpgradeLog.XML
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/projects/VS2008/TestCatch/_UpgradeReport_Files/UpgradeReport.css b/projects/VS2008/TestCatch/_UpgradeReport_Files/UpgradeReport.css
deleted file mode 100644
index fae98af0..00000000
--- a/projects/VS2008/TestCatch/_UpgradeReport_Files/UpgradeReport.css
+++ /dev/null
@@ -1,207 +0,0 @@
-BODY
-{
- BACKGROUND-COLOR: white;
- FONT-FAMILY: "Verdana", sans-serif;
- FONT-SIZE: 100%;
- MARGIN-LEFT: 0px;
- MARGIN-TOP: 0px
-}
-P
-{
- FONT-FAMILY: "Verdana", sans-serif;
- FONT-SIZE: 70%;
- LINE-HEIGHT: 12pt;
- MARGIN-BOTTOM: 0px;
- MARGIN-LEFT: 10px;
- MARGIN-TOP: 10px
-}
-.note
-{
- BACKGROUND-COLOR: #ffffff;
- COLOR: #336699;
- FONT-FAMILY: "Verdana", sans-serif;
- FONT-SIZE: 100%;
- MARGIN-BOTTOM: 0px;
- MARGIN-LEFT: 0px;
- MARGIN-TOP: 0px;
- PADDING-RIGHT: 10px
-}
-.infotable
-{
- BACKGROUND-COLOR: #f0f0e0;
- BORDER-BOTTOM: #ffffff 0px solid;
- BORDER-COLLAPSE: collapse;
- BORDER-LEFT: #ffffff 0px solid;
- BORDER-RIGHT: #ffffff 0px solid;
- BORDER-TOP: #ffffff 0px solid;
- FONT-SIZE: 70%;
- MARGIN-LEFT: 10px
-}
-.issuetable
-{
- BACKGROUND-COLOR: #ffffe8;
- BORDER-COLLAPSE: collapse;
- COLOR: #000000;
- FONT-SIZE: 100%;
- MARGIN-BOTTOM: 10px;
- MARGIN-LEFT: 13px;
- MARGIN-TOP: 0px
-}
-.issuetitle
-{
- BACKGROUND-COLOR: #ffffff;
- BORDER-BOTTOM: #dcdcdc 1px solid;
- BORDER-TOP: #dcdcdc 1px;
- COLOR: #003366;
- FONT-WEIGHT: normal
-}
-.header
-{
- BACKGROUND-COLOR: #cecf9c;
- BORDER-BOTTOM: #ffffff 1px solid;
- BORDER-LEFT: #ffffff 1px solid;
- BORDER-RIGHT: #ffffff 1px solid;
- BORDER-TOP: #ffffff 1px solid;
- COLOR: #000000;
- FONT-WEIGHT: bold
-}
-.issuehdr
-{
- BACKGROUND-COLOR: #E0EBF5;
- BORDER-BOTTOM: #dcdcdc 1px solid;
- BORDER-TOP: #dcdcdc 1px solid;
- COLOR: #000000;
- FONT-WEIGHT: normal
-}
-.issuenone
-{
- BACKGROUND-COLOR: #ffffff;
- BORDER-BOTTOM: 0px;
- BORDER-LEFT: 0px;
- BORDER-RIGHT: 0px;
- BORDER-TOP: 0px;
- COLOR: #000000;
- FONT-WEIGHT: normal
-}
-.content
-{
- BACKGROUND-COLOR: #e7e7ce;
- BORDER-BOTTOM: #ffffff 1px solid;
- BORDER-LEFT: #ffffff 1px solid;
- BORDER-RIGHT: #ffffff 1px solid;
- BORDER-TOP: #ffffff 1px solid;
- PADDING-LEFT: 3px
-}
-.issuecontent
-{
- BACKGROUND-COLOR: #ffffff;
- BORDER-BOTTOM: #dcdcdc 1px solid;
- BORDER-TOP: #dcdcdc 1px solid;
- PADDING-LEFT: 3px
-}
-A:link
-{
- COLOR: #cc6633;
- TEXT-DECORATION: underline
-}
-A:visited
-{
- COLOR: #cc6633;
-}
-A:active
-{
- COLOR: #cc6633;
-}
-A:hover
-{
- COLOR: #cc3300;
- TEXT-DECORATION: underline
-}
-H1
-{
- BACKGROUND-COLOR: #003366;
- BORDER-BOTTOM: #336699 6px solid;
- COLOR: #ffffff;
- FONT-SIZE: 130%;
- FONT-WEIGHT: normal;
- MARGIN: 0em 0em 0em -20px;
- PADDING-BOTTOM: 8px;
- PADDING-LEFT: 30px;
- PADDING-TOP: 16px
-}
-H2
-{
- COLOR: #000000;
- FONT-SIZE: 80%;
- FONT-WEIGHT: bold;
- MARGIN-BOTTOM: 3px;
- MARGIN-LEFT: 10px;
- MARGIN-TOP: 20px;
- PADDING-LEFT: 0px
-}
-H3
-{
- COLOR: #000000;
- FONT-SIZE: 80%;
- FONT-WEIGHT: bold;
- MARGIN-BOTTOM: -5px;
- MARGIN-LEFT: 10px;
- MARGIN-TOP: 20px
-}
-H4
-{
- COLOR: #000000;
- FONT-SIZE: 70%;
- FONT-WEIGHT: bold;
- MARGIN-BOTTOM: 0px;
- MARGIN-TOP: 15px;
- PADDING-BOTTOM: 0px
-}
-UL
-{
- COLOR: #000000;
- FONT-SIZE: 70%;
- LIST-STYLE: square;
- MARGIN-BOTTOM: 0pt;
- MARGIN-TOP: 0pt
-}
-OL
-{
- COLOR: #000000;
- FONT-SIZE: 70%;
- LIST-STYLE: square;
- MARGIN-BOTTOM: 0pt;
- MARGIN-TOP: 0pt
-}
-LI
-{
- LIST-STYLE: square;
- MARGIN-LEFT: 0px
-}
-.expandable
-{
- CURSOR: hand
-}
-.expanded
-{
- color: black
-}
-.collapsed
-{
- DISPLAY: none
-}
-.foot
-{
-BACKGROUND-COLOR: #ffffff;
-BORDER-BOTTOM: #cecf9c 1px solid;
-BORDER-TOP: #cecf9c 2px solid
-}
-.settings
-{
-MARGIN-LEFT: 25PX;
-}
-.help
-{
-TEXT-ALIGN: right;
-margin-right: 10px;
-}
diff --git a/projects/VS2008/TestCatch/_UpgradeReport_Files/UpgradeReport.xslt b/projects/VS2008/TestCatch/_UpgradeReport_Files/UpgradeReport.xslt
deleted file mode 100644
index 73c4e7af..00000000
--- a/projects/VS2008/TestCatch/_UpgradeReport_Files/UpgradeReport.xslt
+++ /dev/null
@@ -1,232 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-