forked from beanstalkd/go-beanstalk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse_test.go
48 lines (41 loc) · 874 Bytes
/
parse_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
46
47
48
package beanstalk
import (
"reflect"
"testing"
)
func TestParseDict(t *testing.T) {
d := parseDict([]byte("---\na: 1\nb: 2\n"))
if !reflect.DeepEqual(d, map[string]string{"a": "1", "b": "2"}) {
t.Fatalf("got %v", d)
}
}
func TestParseDictEmpty(t *testing.T) {
d := parseDict([]byte{})
if !reflect.DeepEqual(d, map[string]string{}) {
t.Fatalf("got %v", d)
}
}
func TestParseDictNil(t *testing.T) {
d := parseDict(nil)
if d != nil {
t.Fatalf("got %v", d)
}
}
func TestParseList(t *testing.T) {
l := parseList([]byte("---\n- 1\n- 2\n"))
if !reflect.DeepEqual(l, []string{"1", "2"}) {
t.Fatalf("got %v", l)
}
}
func TestParseListEmpty(t *testing.T) {
l := parseList([]byte{})
if !reflect.DeepEqual(l, []string{}) {
t.Fatalf("got %v", l)
}
}
func TestParseListNil(t *testing.T) {
l := parseList(nil)
if l != nil {
t.Fatalf("got %v", l)
}
}