Skip to content

Commit 5171319

Browse files
committed
completion: add test for FromList
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent a5ca5b3 commit 5171319

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎cli/command/completion/functions_test.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ func TestCompleteFileNames(t *testing.T) {
2929
assert.Check(t, is.Len(values, 0))
3030
}
3131

32+
func TestCompleteFromList(t *testing.T) {
33+
expected := []string{"one", "two", "three"}
34+
35+
values, directives := FromList(expected...)(nil, nil, "")
36+
assert.Check(t, is.Equal(directives&cobra.ShellCompDirectiveNoFileComp, cobra.ShellCompDirectiveNoFileComp), "Should not perform file completion")
37+
assert.Check(t, is.DeepEqual(values, expected))
38+
}
39+
3240
func TestCompletePlatforms(t *testing.T) {
3341
values, directives := Platforms(nil, nil, "")
3442
assert.Check(t, is.Equal(directives&cobra.ShellCompDirectiveNoFileComp, cobra.ShellCompDirectiveNoFileComp), "Should not perform file completion")

0 commit comments

Comments
 (0)