func TestLength(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	bs, _ := createDocument(assert)
	doc, err := gjp.Parse(bs, "/")
	assert.Nil(err)
	l := doc.Length("X")
	assert.Equal(l, -1)
	l = doc.Length("")
	assert.Equal(l, 4)
	l = doc.Length("B")
	assert.Equal(l, 3)
	l = doc.Length("B/2")
	assert.Equal(l, 5)
	l = doc.Length("/B/2/D")
	assert.Equal(l, 2)
	l = doc.Length("/B/1/S")
	assert.Equal(l, 3)
	l = doc.Length("/B/1/S/0")
	assert.Equal(l, 1)
}
TestLength tests retrieving values as strings.
package gjp_test
import (
	"encoding/json"
	"errors"
	"testing"
	"time"
	"github.com/tideland/golib/audit"
	"github.com/tideland/golib/gjp"
)
func TestParseError(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	bs := []byte(`abc{def`)
	doc, err := gjp.Parse(bs, "/")
	assert.Nil(doc)
	assert.ErrorMatch(err, `.*cannot unmarshal document.*`)
}
func TestClear(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	bs, _ := createDocument(assert)
	doc, err := gjp.Parse(bs, "/")
	assert.Nil(err)
	doc.Clear()
	doc.SetValueAt("/", "foo")
	foo := doc.ValueAt("/").AsString("<undefined>")
	assert.Equal(foo, "foo")
}