summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gentoobrowse-api/service/mask.cpp2
-rw-r--r--gentoobrowse-api/unittests/testMasks.cpp26
2 files changed, 27 insertions, 1 deletions
diff --git a/gentoobrowse-api/service/mask.cpp b/gentoobrowse-api/service/mask.cpp
index e3cc677..7cb62b4 100644
--- a/gentoobrowse-api/service/mask.cpp
+++ b/gentoobrowse-api/service/mask.cpp
@@ -8,7 +8,7 @@ namespace Portage {
(GRegexCompileFlags)(G_REGEX_OPTIMIZE | G_REGEX_CASELESS | G_REGEX_UNGREEDY | G_REGEX_MULTILINE));
static AdHoc::Lexer::PatternPtr maskDesc = AdHoc::LexerMatchers::regex("^# *([^\n]*)$\n", G_REGEX_MULTILINE);
static AdHoc::Lexer::PatternPtr atom = AdHoc::LexerMatchers::regex("^([^\n/]+/[^\n]*)$\n?", G_REGEX_MULTILINE);
- static AdHoc::Lexer::PatternPtr end = AdHoc::LexerMatchers::regex("^$\n", G_REGEX_MULTILINE);
+ static AdHoc::Lexer::PatternPtr end = AdHoc::LexerMatchers::regex("^\\s*$\n", G_REGEX_MULTILINE);
static AdHoc::Lexer::PatternPtr discard = AdHoc::LexerMatchers::regex("^([^\n]*)$\n?", G_REGEX_MULTILINE);
Masks::Masks() :
diff --git a/gentoobrowse-api/unittests/testMasks.cpp b/gentoobrowse-api/unittests/testMasks.cpp
index 8aba4ea..e80fe1c 100644
--- a/gentoobrowse-api/unittests/testMasks.cpp
+++ b/gentoobrowse-api/unittests/testMasks.cpp
@@ -48,5 +48,31 @@ BOOST_AUTO_TEST_CASE(f1)
"dev-java/xml-im-exporter");
}
+BOOST_AUTO_TEST_CASE(whitespaceline)
+{
+ const gchar * input = R"MASK(#--- END OF EXAMPLES ---
+
+# James Le Cuirot <chewi@gentoo.org> (25 Apr 1016)
+#
+# TEST DATA - the blank line between the package list of this mask
+# and the heder of the next deliberately contains whitespace.
+#
+dev-java/charva
+dev-java/jakarta-slide-webdavclient
+dev-java/xml-im-exporter
+
+# Alex Brandt <alunduil@gentoo.org> (23 Apr 3016)
+# Contains collisions with dev-python/ipaddress. See #580388 for more details.
+# Masked for removal in 30 days.
+dev-python/py2-ipaddress
+
+# Michael Palimaka <kensington@gentoo.org> (21 Apr 2016))MASK";
+ extract(input, strlen(input));
+ BOOST_CHECK_EQUAL(masks.size(), 2);
+ BOOST_CHECK_EQUAL(masks.front()->atomspec.size(), 3);
+ BOOST_CHECK_EQUAL(masks.front()->atomspec.back(), "dev-java/xml-im-exporter");
+ BOOST_CHECK_EQUAL(*masks.back()->person, "Alex Brandt");
+}
+
BOOST_AUTO_TEST_SUITE_END()