7
func TestEmpty(t *testing.T) {
10
failUnlessEqual(t, [](interface{}){}, a, "slice")
13
func TestTwoEmpties(t *testing.T) {
14
a, err := Parse("{,}")
15
failUnlessError(t, err, a)
18
func TestTwoQuotedEmpties(t *testing.T) {
19
a, err := Parse("{\"\",\"\"}")
21
failUnlessEqual(t, [](interface{}){"", ""}, a, "slice")
24
func TestWhitespace(t *testing.T) {
25
a, err := Parse("{ a }")
26
failUnlessError(t, err, a)
29
func TestQuotedWhitespace(t *testing.T) {
30
a, err := Parse("{\" a \"}")
32
failUnlessEqual(t, [](interface{}){" a "}, a, "slice")
35
func TestEmpty2D(t *testing.T) {
36
a, err := Parse("{{}}")
38
failUnlessEqual(t, [](interface{}){[](interface{}){}}, a, "slice")
41
func TestErrorEndBrace(t *testing.T) {
42
a, err := Parse("{}}")
43
failUnlessError(t, err, a)
46
func TestErrorEndJustABrace(t *testing.T) {
48
failUnlessError(t, err, a)
51
func TestOne(t *testing.T) {
52
a, err := Parse("{42}")
54
failUnlessEqual(t, [](interface{}){"42"}, a, "slice")
57
func TestQuoted(t *testing.T) {
58
a, err := Parse("{\"NULL\"}")
60
failUnlessEqual(t, [](interface{}){"NULL"}, a, "slice")
63
func TestQuotedQuote(t *testing.T) {
64
a, err := Parse("{\"a\\\"b\"}")
66
failUnlessEqual(t, [](interface{}){"a\"b"}, a, "slice")
69
func TestTwoItems(t *testing.T) {
70
a, err := Parse("{a,\"b\"}")
72
failUnlessEqual(t, [](interface{}){"a", "b"}, a, "slice")
75
func TestTwoArys(t *testing.T) {
76
a, err := Parse("{{a},{b}}")
78
failUnlessEqual(t, [](interface{}){
80
[](interface{}){"b"}}, a, "slice")
83
func TestDeepishAry(t *testing.T) {
84
// note this is not actually a valid psql array
85
a, err := Parse("{0,{0,{0,{0,{0,{0,{0,{0}}}}}}}}")
88
[](interface{}){"0", [](interface{}){"0",
89
[](interface{}){"0", [](interface{}){"0",
90
[](interface{}){"0", [](interface{}){"0",
91
[](interface{}){"0", [](interface{}){"0"}}}}}}}},