Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-10-09 14:16:50 +0200
committerGitHub2019-10-09 14:16:50 +0200
commit1c5749669e85239ce3dd3bb80028d9b8d2402787 (patch)
tree03ca9d9acc16ca5a2ff5c1e9be23adee9b413ac9 /include
parent75200e199e76b246a3e314e70ec181b32baab08a (diff)
parent3109add95ccbc0b388e874253a7894027726cb0c (diff)
downloadcatch3-1c5749669e85239ce3dd3bb80028d9b8d2402787.tar.gz
Merge pull request #1769 from amitherman95/amitherman-1767
Patch:Failure to pass special chars through input file
Diffstat (limited to 'include')
-rw-r--r--include/internal/catch_test_spec_parser.cpp14
-rw-r--r--include/internal/catch_test_spec_parser.h1
2 files changed, 12 insertions, 3 deletions
diff --git a/include/internal/catch_test_spec_parser.cpp b/include/internal/catch_test_spec_parser.cpp
index 5cbbdeb7..718185fa 100644
--- a/include/internal/catch_test_spec_parser.cpp
+++ b/include/internal/catch_test_spec_parser.cpp
@@ -7,6 +7,7 @@
#include "catch_test_spec_parser.h"
+
namespace Catch {
TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {}
@@ -18,6 +19,7 @@ namespace Catch {
m_escapeChars.clear();
m_substring.reserve(m_arg.size());
m_patternName.reserve(m_arg.size());
+ m_realPatternPos = 0;
for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )
visitChar( m_arg[m_pos] );
endMode();
@@ -32,6 +34,7 @@ namespace Catch {
escape();
m_substring += c;
m_patternName += c;
+ m_realPatternPos++;
return;
}else if((m_mode != EscapedName) && (c == ',') ) {
endMode();
@@ -49,7 +52,10 @@ namespace Catch {
break;
case EscapedName:
endMode();
- break;
+ m_substring += c;
+ m_patternName += c;
+ m_realPatternPos++;
+ return;
default:
case Tag:
case QuotedName:
@@ -59,8 +65,10 @@ namespace Catch {
}
m_substring += c;
- if( !isControlChar( c ) )
+ if( !isControlChar( c ) ) {
m_patternName += c;
+ m_realPatternPos++;
+ }
}
// Two of the processing methods return true to signal the caller to return
// without adding the given character to the current pattern strings
@@ -119,7 +127,7 @@ namespace Catch {
void TestSpecParser::escape() {
saveLastMode();
m_mode = EscapedName;
- m_escapeChars.push_back( m_pos );
+ m_escapeChars.push_back(m_realPatternPos);
}
bool TestSpecParser::isControlChar( char c ) const {
switch( m_mode ) {
diff --git a/include/internal/catch_test_spec_parser.h b/include/internal/catch_test_spec_parser.h
index 778da134..c80787c8 100644
--- a/include/internal/catch_test_spec_parser.h
+++ b/include/internal/catch_test_spec_parser.h
@@ -25,6 +25,7 @@ namespace Catch {
Mode lastMode = None;
bool m_exclusion = false;
std::size_t m_pos = 0;
+ std::size_t m_realPatternPos = 0;
std::string m_arg;
std::string m_substring;
std::string m_patternName;