Skip to content

Commit be1359f

Browse files
committed
Fix completion tests
1 parent 400300b commit be1359f

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

test/dotnet.Tests/CompletionTests/snapshots/bash/DotnetCliSnapshotTests.VerifyCompletions.verified.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ _testhost_package() {
10021002
prev="${COMP_WORDS[COMP_CWORD-1]}"
10031003
COMPREPLY=()
10041004

1005-
opts="search add list remove --help"
1005+
opts="search add list remove update --help"
10061006

10071007
if [[ $COMP_CWORD == "$1" ]]; then
10081008
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
@@ -1030,6 +1030,11 @@ _testhost_package() {
10301030
return
10311031
;;
10321032

1033+
(update)
1034+
_testhost_package_update $(($1+1))
1035+
return
1036+
;;
1037+
10331038
esac
10341039

10351040
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
@@ -1122,6 +1127,23 @@ _testhost_package_remove() {
11221127
}
11231128

11241129

1130+
_testhost_package_update() {
1131+
1132+
cur="${COMP_WORDS[COMP_CWORD]}"
1133+
prev="${COMP_WORDS[COMP_CWORD-1]}"
1134+
COMPREPLY=()
1135+
1136+
opts="--project --help"
1137+
1138+
if [[ $COMP_CWORD == "$1" ]]; then
1139+
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
1140+
return
1141+
fi
1142+
1143+
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
1144+
}
1145+
1146+
11251147
_testhost_project() {
11261148

11271149
cur="${COMP_WORDS[COMP_CWORD]}"

test/dotnet.Tests/CompletionTests/snapshots/pwsh/DotnetCliSnapshotTests.VerifyCompletions.verified.ps1

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ Register-ArgumentCompleter -Native -CommandName 'testhost' -ScriptBlock {
571571
[CompletionResult]::new('add', 'add', [CompletionResultType]::ParameterValue, "Add a NuGet package reference to the project.")
572572
[CompletionResult]::new('list', 'list', [CompletionResultType]::ParameterValue, "List all package references of the project or solution.")
573573
[CompletionResult]::new('remove', 'remove', [CompletionResultType]::ParameterValue, "Remove a NuGet package reference from the project.")
574+
[CompletionResult]::new('update', 'update', [CompletionResultType]::ParameterValue, "Update referenced packages in a project or solution.")
574575
)
575576
$completions += $staticCompletions
576577
break
@@ -654,6 +655,15 @@ Register-ArgumentCompleter -Native -CommandName 'testhost' -ScriptBlock {
654655
$completions += $staticCompletions
655656
break
656657
}
658+
'testhost;package;update' {
659+
$staticCompletions = @(
660+
[CompletionResult]::new('--project', '--project', [CompletionResultType]::ParameterName, "Path to a project or solution file, or a directory.")
661+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, "Show command line help.")
662+
[CompletionResult]::new('--help', '-h', [CompletionResultType]::ParameterName, "Show command line help.")
663+
)
664+
$completions += $staticCompletions
665+
break
666+
}
657667
'testhost;project' {
658668
$staticCompletions = @(
659669
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, "Show command line help.")

test/dotnet.Tests/CompletionTests/snapshots/zsh/DotnetCliSnapshotTests.VerifyCompletions.verified.zsh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,14 @@ _testhost() {
644644
'*::PACKAGE_NAME -- The package reference to remove.: ' \
645645
&& ret=0
646646
;;
647+
(update)
648+
_arguments "${_arguments_options[@]}" : \
649+
'--project=[Path to a project or solution file, or a directory.]: : ' \
650+
'--help[Show command line help.]' \
651+
'-h[Show command line help.]' \
652+
'*::packages: ' \
653+
&& ret=0
654+
;;
647655
esac
648656
;;
649657
esac
@@ -1638,6 +1646,7 @@ _testhost__package_commands() {
16381646
'add:Add a NuGet package reference to the project.' \
16391647
'list:List all package references of the project or solution.' \
16401648
'remove:Remove a NuGet package reference from the project.' \
1649+
'update:Update referenced packages in a project or solution.' \
16411650
)
16421651
_describe -t commands 'testhost package commands' commands "$@"
16431652
}
@@ -1666,6 +1675,12 @@ _testhost__package__remove_commands() {
16661675
_describe -t commands 'testhost package remove commands' commands "$@"
16671676
}
16681677

1678+
(( $+functions[_testhost__package__update_commands] )) ||
1679+
_testhost__package__update_commands() {
1680+
local commands; commands=()
1681+
_describe -t commands 'testhost package update commands' commands "$@"
1682+
}
1683+
16691684
(( $+functions[_testhost__project_commands] )) ||
16701685
_testhost__project_commands() {
16711686
local commands; commands=(

0 commit comments

Comments
 (0)