forked from sqrldev/server-go-ssp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli_response_test.go
43 lines (38 loc) · 873 Bytes
/
cli_response_test.go
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
43
package ssp
import "testing"
func TestAskButtonParse(t *testing.T) {
b, u := splitButton("button;https://example.com")
if b != "button" {
t.Errorf("didn't get button value: %v", b)
}
if u != "https://example.com" {
t.Errorf("Failed url: %v", u)
}
}
func TestAskButtonNoURL(t *testing.T) {
b, u := splitButton("button")
if b != "button" {
t.Errorf("didn't get button value: %v", b)
}
if u != "" {
t.Errorf("Failed url: %v", u)
}
}
func TestAskButtonNoURLWithSemi(t *testing.T) {
b, u := splitButton("button;")
if b != "button" {
t.Errorf("didn't get button value: %v", b)
}
if u != "" {
t.Errorf("Failed url: %v", u)
}
}
func TestAskNoButtonWithURL(t *testing.T) {
b, u := splitButton(";https://example.com")
if b != "" {
t.Errorf("didn't get button value: %v", b)
}
if u != "https://example.com" {
t.Errorf("Failed url: %v", u)
}
}