-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathutils_test.go
45 lines (39 loc) · 1.33 KB
/
utils_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
44
45
package huaweicloud
import (
"testing"
)
func TestPrepareRecordValueTXTWithQuotes(t *testing.T) {
result := prepareRecordValue("TXT", `"example"`)
expected := []string{`"example"`}
if len(result) != len(expected) || result[0] != expected[0] {
t.Errorf("expected %v, got %v", expected, result)
}
}
func TestPrepareRecordValueTXTWithoutStartingQuote(t *testing.T) {
result := prepareRecordValue("TXT", `example"`)
expected := []string{`"example"`}
if len(result) != len(expected) || result[0] != expected[0] {
t.Errorf("expected %v, got %v", expected, result)
}
}
func TestPrepareRecordValueTXTWithoutEndingQuote(t *testing.T) {
result := prepareRecordValue("TXT", `"example`)
expected := []string{`"example"`}
if len(result) != len(expected) || result[0] != expected[0] {
t.Errorf("expected %v, got %v", expected, result)
}
}
func TestPrepareRecordValueTXTWithoutQuotes(t *testing.T) {
result := prepareRecordValue("TXT", `example`)
expected := []string{`"example"`}
if len(result) != len(expected) || result[0] != expected[0] {
t.Errorf("expected %v, got %v", expected, result)
}
}
func TestPrepareRecordValueNonTXT(t *testing.T) {
result := prepareRecordValue("A", `example`)
expected := []string{`example`}
if len(result) != len(expected) || result[0] != expected[0] {
t.Errorf("expected %v, got %v", expected, result)
}
}