Correctly handle entries with “empty” suites
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Sun, 27 May 2018 12:40:19 +0000 (14:40 +0200)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Sun, 27 May 2018 12:41:26 +0000 (14:41 +0200)
One example of such an entry is for the SBT repository at
“deb https://dl.bintray.com/sbt/debian /”.

apt-sources-list-test.el
apt-sources-list.el

index 54a1f57..6e5dfd9 100644 (file)
@@ -125,6 +125,13 @@ deb-src http://deb.test/debian stable main")))
     (type "C-c C-s stable RET")
     (should-equal-buffer "deb http://deb.test/debian stable xxx # foo")))
 
+(ert-deftest apt-sources-list-test-change-suite-empty ()
+  (with-apt-sources-list "deb http://deb.test/debian stable main # foo"
+    (type "C-c C-s / RET")
+    (should-equal-buffer "deb http://deb.test/debian / # foo")
+    (type "C-c C-s unstable RET M-0 C-k xxx RET")
+    (should-equal-buffer "deb http://deb.test/debian unstable xxx # foo")))
+
 (ert-deftest apt-sources-list-test-change-components ()
   (with-apt-sources-list "deb http://deb.test/debian stable main # foo"
     (type "C-c C-c M-0 C-k a SPC b")
index f5b049c..ed4c876 100644 (file)
@@ -112,7 +112,7 @@ single “%s” which will be replaced with the source name."
        (one-or-more (not (any " \t\n#"))))
       (one-or-more blank)
       (group
-       (or (and (one-or-more (not (any " \t\n#"))) "/")
+       (or (and (zero-or-more (not (any " \t\n#"))) "/")
            (and (zero-or-more (not (any " \t\n#")))
                 (not (any " \t\n/#"))
                 (one-or-more blank)