]> gitweb.factorcode.org Git - factor.git/commitdiff
tools.completion: adding some test cases for complete-pathname?.
authorJohn Benediktsson <mrjbq7@gmail.com>
Sun, 2 Jan 2022 20:09:47 +0000 (12:09 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Sun, 2 Jan 2022 20:09:47 +0000 (12:09 -0800)
basis/tools/completion/completion-tests.factor
basis/tools/completion/completion.factor

index 851ca757c822b75696013803934e19fc5963491e..643b4eedff466c367fcfe585af4ed13b11f50073 100644 (file)
@@ -35,3 +35,9 @@ USING: assocs kernel sequences tools.completion tools.test ;
 { f } [ { "CHAR:" } complete-char? ] unit-test
 { t } [ { "CHAR:" "" } complete-char? ] unit-test
 { t } [ { "CHAR:" "a" } complete-char? ] unit-test
+
+{ t } [ { "P\"" } complete-pathname? ] unit-test
+{ t } [ { "P\"" "" } complete-pathname? ] unit-test
+{ t } [ { "P\"" "~/" } complete-pathname? ] unit-test
+{ f } [ { "P\"~/\"" "" } complete-pathname? ] unit-test
+{ f } [ { "P\"~/\"" "asdf" } complete-pathname? ] unit-test
index cf469e13ec61511afd4341d1e455bfbe4f9f7ec2..2f9ae4cb7dbafbe1cd2af6c82809aa2021f0eef3 100644 (file)
@@ -180,7 +180,13 @@ PRIVATE>
 <PRIVATE
 
 : complete-string? ( tokens token -- ? )
-    { [ [ harvest ?last ] [ head? ] bi* ] [ complete-token? ] } 2|| ;
+    {
+        [
+            [ harvest ?last ] dip ?head
+            [ ?last CHAR: \" = not ] [ drop f ] if
+        ]
+        [ complete-token? ]
+    } 2|| ;
 
 PRIVATE>