summaryrefslogtreecommitdiff
path: root/complete_test.go
diff options
context:
space:
mode:
authorEyal Posener <[email protected]>2017-05-15 23:52:04 +0300
committerEyal Posener <[email protected]>2017-05-18 23:29:55 +0300
commit61d9904ba1f47bf5bbd3497ac0c9f5787adb8633 (patch)
tree17357f14eadb4654287eb664dfbe02914167f4db /complete_test.go
parent659bd9e3d5a0113fb862bcbd06a983b0e74e8df7 (diff)
Fix './' prefix for file completion
Diffstat (limited to 'complete_test.go')
-rw-r--r--complete_test.go18
1 files changed, 12 insertions, 6 deletions
diff --git a/complete_test.go b/complete_test.go
index cd61ceb..135c6ad 100644
--- a/complete_test.go
+++ b/complete_test.go
@@ -35,8 +35,6 @@ func TestCompleter_Complete(t *testing.T) {
},
}
- testTXTFiles := []string{"./a.txt", "./b.txt", "./c.txt", "./.dot.txt"}
-
tests := []struct {
args string
want []string
@@ -75,7 +73,7 @@ func TestCompleter_Complete(t *testing.T) {
},
{
args: "sub2 ",
- want: []string{"./", "./dir/", "./outer/", "./readme.md", "-flag2", "-flag3", "-h", "-global1"},
+ want: []string{"./", "dir/", "outer/", "readme.md", "-flag2", "-flag3", "-h", "-global1"},
},
{
args: "sub2 ./",
@@ -83,11 +81,15 @@ func TestCompleter_Complete(t *testing.T) {
},
{
args: "sub2 re",
+ want: []string{"readme.md"},
+ },
+ {
+ args: "sub2 ./re",
want: []string{"./readme.md"},
},
{
args: "sub2 -flag2 ",
- want: []string{"./", "./dir/", "./outer/", "./readme.md", "-flag2", "-flag3", "-h", "-global1"},
+ want: []string{"./", "dir/", "outer/", "readme.md", "-flag2", "-flag3", "-h", "-global1"},
},
{
args: "sub1 -fl",
@@ -123,7 +125,7 @@ func TestCompleter_Complete(t *testing.T) {
},
{
args: "-o ",
- want: append(testTXTFiles, "./", "./dir/", "./outer/"),
+ want: []string{"a.txt", "b.txt", "c.txt", ".dot.txt", "./", "dir/", "outer/"},
},
{
args: "-o ./no-su",
@@ -131,7 +133,11 @@ func TestCompleter_Complete(t *testing.T) {
},
{
args: "-o ./",
- want: append(testTXTFiles, "./", "./dir/", "./outer/"),
+ want: []string{"./a.txt", "./b.txt", "./c.txt", "./.dot.txt", "./", "./dir/", "./outer/"},
+ },
+ {
+ args: "-o .",
+ want: []string{"./a.txt", "./b.txt", "./c.txt", "./.dot.txt", "./", "./dir/", "./outer/"},
},
{
args: "-o ./read",