@@ -1715,9 +1715,8 @@ def test_ctrl_r_abort
1715
1715
module CompletionTest
1716
1716
include TestShell
1717
1717
1718
- def test_file_completion
1718
+ def test_file_completion1
1719
1719
FileUtils . touch ( ( '1' ..'100' ) . to_a )
1720
- FileUtils . touch ( [ 'no~such~user' , 'foobar' , File . expand_path ( '~/.fzf-home' ) ] )
1721
1720
tmux . prepare
1722
1721
tmux . send_keys ( 'cat 10**' , :Tab )
1723
1722
tmux . until { |lines | lines . match_count == 2 }
@@ -1727,9 +1726,24 @@ def test_file_completion
1727
1726
tmux . until do |lines |
1728
1727
lines [ -1 ] == '$ cat 10 100'
1729
1728
end
1729
+ end
1730
1730
1731
- # ~USERNAME**<TAB>
1732
- tmux . send_keys ( 'C-u' )
1731
+ # **<TAB>
1732
+ def test_file_completion2
1733
+ FileUtils . touch ( 'foobar' )
1734
+ tmux . prepare
1735
+ tmux . send_keys ( 'cat **' , :Tab )
1736
+ tmux . until { |lines | lines . match_count > 0 }
1737
+ tmux . send_keys ( 'foobar$' )
1738
+ tmux . until { |lines | lines . match_count == 1 }
1739
+ tmux . send_keys ( :Enter )
1740
+ tmux . until { |lines | lines [ -1 ] == '$ cat foobar' }
1741
+ end
1742
+
1743
+ # ~USERNAME**<TAB>
1744
+ def test_file_completion_username
1745
+ FileUtils . touch ( File . expand_path ( '~/.fzf-home' ) )
1746
+ tmux . prepare
1733
1747
tmux . send_keys ( "cat ~#{ ENV [ 'USER' ] } **" , :Tab )
1734
1748
tmux . until { |lines | lines . match_count > 0 }
1735
1749
tmux . send_keys ( "'.fzf-home" )
@@ -1738,30 +1752,26 @@ def test_file_completion
1738
1752
tmux . until do |lines |
1739
1753
lines [ -1 ] =~ %r{cat .*/\. fzf-home}
1740
1754
end
1755
+ ensure
1756
+ File . unlink ( File . expand_path ( '~/.fzf-home' ) )
1757
+ end
1741
1758
1742
- # ~INVALID_USERNAME**<TAB>
1743
- tmux . send_keys ( 'C-u' )
1759
+ # ~INVALID_USERNAME**<TAB>
1760
+ def test_file_completion_invalid_username
1761
+ FileUtils . touch ( 'no~such~user' )
1762
+ tmux . prepare
1744
1763
tmux . send_keys ( 'cat ~such**' , :Tab )
1745
1764
tmux . until { |lines | lines . any_include? ( 'no~such~user' ) }
1746
1765
tmux . send_keys ( :Enter )
1747
1766
tmux . until { |lines | lines [ -1 ] == '$ cat no~such~user' }
1767
+ end
1748
1768
1749
- # **<TAB>
1750
- tmux . send_keys ( 'C-u' )
1751
- tmux . send_keys ( 'cat **' , :Tab )
1752
- tmux . until { |lines | lines . match_count > 0 }
1753
- tmux . send_keys ( 'foobar$' )
1754
- tmux . until { |lines | lines . match_count == 1 }
1755
- tmux . send_keys ( :Enter )
1756
- tmux . until { |lines | lines [ -1 ] == '$ cat foobar' }
1757
-
1758
- # Should include hidden files
1769
+ # Should include hidden files
1770
+ def test_file_completion_hidden
1759
1771
FileUtils . touch ( ( 1 ..100 ) . map { |i | ".hidden-#{ i } " } )
1760
- tmux . send_keys ( 'C-u' )
1772
+ tmux . prepare
1761
1773
tmux . send_keys ( 'cat hidden**' , :Tab )
1762
1774
tmux . until { |lines | lines . match_count == 100 && lines . any_include? ( '.hidden-' ) }
1763
- ensure
1764
- File . unlink ( File . expand_path ( '~/.fzf-home' ) )
1765
1775
end
1766
1776
1767
1777
def test_file_completion_root
0 commit comments