Przeglądaj źródła

Add a test for empty collection

Ryan C. Thompson 7 lat temu
rodzic
commit
917f187a51
1 zmienionych plików z 10 dodań i 1 usunięć
  1. 10 1
      tests/test-ido-completing-read+.el

+ 10 - 1
tests/test-ido-completing-read+.el

@@ -231,6 +231,14 @@ also accept a quoted list for the sake of convenience."
          (ido-completing-read+ "Prompt: " (collection-as-function '("blue" "yellow" "green"))))
        :to-equal "green"))
 
+    (it "should fall back when COLLECTION is empty"
+      (spy-on 'ido-completing-read :and-call-through)
+      (expect
+       (with-simulated-input "g RET"
+         (ido-completing-read+ "Prompt: " nil))
+       :to-equal "g")
+      (expect 'ido-completing-read :not :to-have-been-called))
+
     (describe "when `ido-cr+-max-items' is set"
       (it "should not trigger a fallback for small collections"
         (expect
@@ -727,7 +735,8 @@ also accept a quoted list for the sake of convenience."
               (symbol-function 'cmd-that-calls-blacklisted-function) nil
               (symbol-function 'blacklisted-collection) nil))
       ;; First verify that they work normally before blacklisting them
-      (describe "when the blacklist is empty"
+      (describe "when the specified functions are not blacklisted"
+
         (it "should not affect a non-blacklisted command"
           (expect
            (with-simulated-input "g RET"