forked from Songmu/prompter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfuncs_test.go
More file actions
42 lines (35 loc) · 763 Bytes
/
funcs_test.go
File metadata and controls
42 lines (35 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package prompter
import (
"regexp"
"testing"
)
func TestPrompt(t *testing.T) {
if Prompt("enter!", "ent") != "ent" {
t.Errorf("something went wrong")
}
}
func TestYN(t *testing.T) {
if !YN("enter!", true) {
t.Errorf("something went wrong")
}
}
func TestYesNo(t *testing.T) {
if YesNo("enter!", false) {
t.Errorf("something went wrong")
}
}
func TestPassword(t *testing.T) {
if Password("enter!") != "" {
t.Errorf("something went wrong")
}
}
func TestChoose(t *testing.T) {
if Choose("enter!", []string{"Perl", "Golang"}, "Perl") != "Perl" {
t.Errorf("something went wrong")
}
}
func TestRegexp(t *testing.T) {
if Regexp("enter!", regexp.MustCompile(`\A(?:Perl|Golang)\z`), "Perl") != "Perl" {
t.Errorf("something went wrong")
}
}