Skip to content

Commit 2f2c63b

Browse files
committed
fix tester command and add coverage for spaced paths
1 parent 9dea691 commit 2f2c63b

File tree

9 files changed

+22
-8
lines changed

9 files changed

+22
-8
lines changed

lib/completely/templates/tester-template.erb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ COMP_POINT=${#COMP_LINE}
1616
COMP_CWORD=<%= cword %>
1717

1818
<%= function_name %>
19-
echo "${COMPREPLY[*]}"
19+
for suggestion in "${COMPREPLY[@]}"; do
20+
echo "$suggestion"
21+
done
22+

lib/completely/tester.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def test(compline)
1414
f << tester_script(compline)
1515
f.flush
1616
`bash #{f.path}`
17-
end.split " "
17+
end.split "\n"
1818
end
1919

2020
def tester_script(compline)

spec/approvals/cli/test/completely-tester.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,7 @@ COMP_POINT=${#COMP_LINE}
4848
COMP_CWORD=2
4949

5050
_mygit_completions
51-
echo "${COMPREPLY[*]}"
51+
for suggestion in "${COMPREPLY[@]}"; do
52+
echo "$suggestion"
53+
done
54+

spec/approvals/tester/script

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ COMP_POINT=${#COMP_LINE}
1616
COMP_CWORD=1
1717

1818
_cli_completions
19-
echo "${COMPREPLY[*]}"
19+
for suggestion in "${COMPREPLY[@]}"; do
20+
echo "$suggestion"
21+
done
22+

spec/approvals/tester/script_path

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ COMP_POINT=${#COMP_LINE}
1616
COMP_CWORD=1
1717

1818
_cli_completions
19-
echo "${COMPREPLY[*]}"
19+
for suggestion in "${COMPREPLY[@]}"; do
20+
echo "$suggestion"
21+
done
22+

spec/completely/integration.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ ftp:
77

88
- compline: "ftp download "
99
expected: [--help, --override, another-dir, dummy-dir, ftp.yaml, gradual.yaml]
10+
expected: [--help, --override, another-dir, dir with spaces, dummy-dir, file with spaces.txt, ftp.yaml, gradual.yaml]
1011

1112
- compline: "ftp upload "
12-
expected: [--confirm, --help, another-dir, dummy-dir]
13+
expected: [--confirm, --help, another-dir, dir with spaces, dummy-dir]
1314

1415
- compline: "ftp connect ssh "
1516
expected: [--keyfile]

spec/completely/zsh_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020

2121
describe "completions script and test script" do
2222
it "returns completions without erroring" do
23-
expect(subject).to eq "somedir --help --force"
23+
expect(subject).to eq "somedir\n--help\n--force"
2424
end
2525

2626
context "on bash" do
2727
let(:shell) { 'bash' }
2828

2929
it "returns the same output" do
30-
expect(subject).to eq "somedir --help --force"
30+
expect(subject).to eq "somedir\n--help\n--force"
3131
end
3232
end
3333
end

spec/fixtures/integration/dir with spaces/.keep

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<-- more spaces

0 commit comments

Comments
 (0)