1
0
Files
Skill/manager/internal/prompt/prompt_test.go

31 lines
653 B
Go

package prompt
import (
"strings"
"testing"
)
func TestConfirmWithReader_Yes(t *testing.T) {
tests := []string{"y", "Y", "yes", "YES", "Yes"}
for _, input := range tests {
reader := strings.NewReader(input + "\n")
result := ConfirmWithReader("测试?", reader)
if !result {
t.Errorf("输入 '%s' 应返回 true", input)
}
}
}
func TestConfirmWithReader_No(t *testing.T) {
tests := []string{"n", "N", "no", "NO", "No", "", "anything"}
for _, input := range tests {
reader := strings.NewReader(input + "\n")
result := ConfirmWithReader("测试?", reader)
if result {
t.Errorf("输入 '%s' 应返回 false", input)
}
}
}