代码拉取完成,页面将自动刷新
同步操作将从 Gitee 极速下载/kingpin 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package kingpin
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestResolveWithBuiltin(t *testing.T) {
a := completionsMixin{}
hintAction1 := func() []string {
return []string{"opt1", "opt2"}
}
hintAction2 := func() []string {
return []string{"opt3", "opt4"}
}
a.builtinHintActions = []HintAction{hintAction1, hintAction2}
args := a.resolveCompletions()
assert.Equal(t, []string{"opt1", "opt2", "opt3", "opt4"}, args)
}
func TestResolveWithUser(t *testing.T) {
a := completionsMixin{}
hintAction1 := func() []string {
return []string{"opt1", "opt2"}
}
hintAction2 := func() []string {
return []string{"opt3", "opt4"}
}
a.hintActions = []HintAction{hintAction1, hintAction2}
args := a.resolveCompletions()
assert.Equal(t, []string{"opt1", "opt2", "opt3", "opt4"}, args)
}
func TestResolveWithCombination(t *testing.T) {
a := completionsMixin{}
builtin := func() []string {
return []string{"opt1", "opt2"}
}
user := func() []string {
return []string{"opt3", "opt4"}
}
a.builtinHintActions = []HintAction{builtin}
a.hintActions = []HintAction{user}
args := a.resolveCompletions()
// User provided args take preference over builtin (enum-defined) args.
assert.Equal(t, []string{"opt3", "opt4"}, args)
}
func TestAddHintAction(t *testing.T) {
a := completionsMixin{}
hintFunc := func() []string {
return []string{"opt1", "opt2"}
}
a.addHintAction(hintFunc)
args := a.resolveCompletions()
assert.Equal(t, []string{"opt1", "opt2"}, args)
}
func TestAddHintActionBuiltin(t *testing.T) {
a := completionsMixin{}
hintFunc := func() []string {
return []string{"opt1", "opt2"}
}
a.addHintActionBuiltin(hintFunc)
args := a.resolveCompletions()
assert.Equal(t, []string{"opt1", "opt2"}, args)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。