]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
Fix the test case
authorMartin Vidner <mvidner@suse.cz>
Mon, 14 Oct 2019 12:35:32 +0000 (14:35 +0200)
committerMartin Vidner <mvidner@suse.cz>
Tue, 15 Oct 2019 12:42:19 +0000 (14:42 +0200)
snapper/AsciiFile.cc
snapper/Regex.cc
snapper/Regex.h

index 04714ab9bffaaaad24b0ae7d49a8b2368ba367fc..f86a7a7db4f9d042b0f9f1a76a29baa9b528603d 100644 (file)
@@ -226,7 +226,9 @@ AsciiFile::save()
     bool
     SysconfigFile::getValue(const string& key, string& value) const
     {
-       Regex rx('^' + Regex::ws + key + '=' + "(['\"]?)([^'\"]*)\\1" + Regex::ws + '$');
+        Regex rx('^' + Regex::ws +
+                 key + '=' + "(['\"]?)([^'\"]*)\\1" +
+                 Regex::ws + Regex::trailing_comment + '$');
 
        if (find_if(lines(), regex_matches(rx)) == lines().end())
            return false;
index 6f078a9f06c19f31541da98e59628a2092f920ae..1a33acc727ba2d6afde13952f3c830b6bab1de07 100644 (file)
@@ -97,5 +97,6 @@ Regex::cap (unsigned int i) const
 
 const string Regex::ws = "[ \t]*";
 const string Regex::number = "[0123456789]+";
+const string Regex::trailing_comment = "(#.*)?";
 
 }
index 8dd5aa9f341c5fb433433d0ed97de2ca1c2b913e..00ff1db8f9a044839e07d6e21e1c8c5c60e65d0d 100644 (file)
@@ -54,6 +54,7 @@ public:
 
     static const string ws;
     static const string number;
+    static const string trailing_comment;
 
 private: