Skip to content

Commit 6d89b44

Browse files
committed
Fix completion tests
1 parent 4e93eac commit 6d89b44

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
@@ -1006,7 +1006,7 @@ _testhost_package() {
10061006
prev="${COMP_WORDS[COMP_CWORD-1]}"
10071007
COMPREPLY=()
10081008

1009-
opts="search add list remove --help"
1009+
opts="search add list remove update --help"
10101010

10111011
if [[ $COMP_CWORD == "$1" ]]; then
10121012
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
@@ -1034,6 +1034,11 @@ _testhost_package() {
10341034
return
10351035
;;
10361036

1037+
(update)
1038+
_testhost_package_update $(($1+1))
1039+
return
1040+
;;
1041+
10371042
esac
10381043

10391044
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
@@ -1126,6 +1131,23 @@ _testhost_package_remove() {
11261131
}
11271132

11281133

1134+
_testhost_package_update() {
1135+
1136+
cur="${COMP_WORDS[COMP_CWORD]}"
1137+
prev="${COMP_WORDS[COMP_CWORD-1]}"
1138+
COMPREPLY=()
1139+
1140+
opts="--project --help"
1141+
1142+
if [[ $COMP_CWORD == "$1" ]]; then
1143+
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
1144+
return
1145+
fi
1146+
1147+
COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
1148+
}
1149+
1150+
11291151
_testhost_project() {
11301152

11311153
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
@@ -573,6 +573,7 @@ Register-ArgumentCompleter -Native -CommandName 'testhost' -ScriptBlock {
573573
[CompletionResult]::new('add', 'add', [CompletionResultType]::ParameterValue, "Add a NuGet package reference to the project.")
574574
[CompletionResult]::new('list', 'list', [CompletionResultType]::ParameterValue, "List all package references of the project or solution.")
575575
[CompletionResult]::new('remove', 'remove', [CompletionResultType]::ParameterValue, "Remove a NuGet package reference from the project.")
576+
[CompletionResult]::new('update', 'update', [CompletionResultType]::ParameterValue, "Update referenced packages in a project or solution.")
576577
)
577578
$completions += $staticCompletions
578579
break
@@ -656,6 +657,15 @@ Register-ArgumentCompleter -Native -CommandName 'testhost' -ScriptBlock {
656657
$completions += $staticCompletions
657658
break
658659
}
660+
'testhost;package;update' {
661+
$staticCompletions = @(
662+
[CompletionResult]::new('--project', '--project', [CompletionResultType]::ParameterName, "Path to a project or solution file, or a directory.")
663+
[CompletionResult]::new('--help', '--help', [CompletionResultType]::ParameterName, "Show command line help.")
664+
[CompletionResult]::new('--help', '-h', [CompletionResultType]::ParameterName, "Show command line help.")
665+
)
666+
$completions += $staticCompletions
667+
break
668+
}
659669
'testhost;project' {
660670
$staticCompletions = @(
661671
[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
@@ -646,6 +646,14 @@ _testhost() {
646646
'*::PACKAGE_NAME -- The package reference to remove.: ' \
647647
&& ret=0
648648
;;
649+
(update)
650+
_arguments "${_arguments_options[@]}" : \
651+
'--project=[Path to a project or solution file, or a directory.]: : ' \
652+
'--help[Show command line help.]' \
653+
'-h[Show command line help.]' \
654+
'*::packages: ' \
655+
&& ret=0
656+
;;
649657
esac
650658
;;
651659
esac
@@ -1640,6 +1648,7 @@ _testhost__package_commands() {
16401648
'add:Add a NuGet package reference to the project.' \
16411649
'list:List all package references of the project or solution.' \
16421650
'remove:Remove a NuGet package reference from the project.' \
1651+
'update:Update referenced packages in a project or solution.' \
16431652
)
16441653
_describe -t commands 'testhost package commands' commands "$@"
16451654
}
@@ -1668,6 +1677,12 @@ _testhost__package__remove_commands() {
16681677
_describe -t commands 'testhost package remove commands' commands "$@"
16691678
}
16701679

1680+
(( $+functions[_testhost__package__update_commands] )) ||
1681+
_testhost__package__update_commands() {
1682+
local commands; commands=()
1683+
_describe -t commands 'testhost package update commands' commands "$@"
1684+
}
1685+
16711686
(( $+functions[_testhost__project_commands] )) ||
16721687
_testhost__project_commands() {
16731688
local commands; commands=(

0 commit comments

Comments
 (0)