Test more Parse failures
This commit is contained in:
parent
c770c1ca8b
commit
4a13ec209d
@ -44,7 +44,26 @@ func TestParseFails(t *testing.T) {
|
|||||||
test.Error(t, err)
|
test.Error(t, err)
|
||||||
test.Nil(t, parsed)
|
test.Nil(t, parsed)
|
||||||
}))
|
}))
|
||||||
t.Run("with too little input", rapid.MakeCheck(func(t *rapid.T) {}))
|
t.Run("with too little input", rapid.MakeCheck(func(t *rapid.T) {
|
||||||
|
sexp := gen.Sexp().Draw(t, "sexp")
|
||||||
|
b := []byte(sexp.String())
|
||||||
|
missing := rapid.IntRange(1, len(b)).Draw(t, "missing")
|
||||||
|
b = b[:len(b)-missing]
|
||||||
|
parsed, err := csexp.Parse(b)
|
||||||
|
test.Error(t, err)
|
||||||
|
test.Nil(t, parsed)
|
||||||
|
}))
|
||||||
|
t.Run("with malformed atom length", rapid.MakeCheck(func(t *rapid.T) {
|
||||||
|
atom := gen.Atom().Draw(t, "atom")
|
||||||
|
s := []byte(atom.String())
|
||||||
|
changeIdx := rapid.IntRange(0, bytes.IndexByte(s, ':')).Draw(t, "changeIdx")
|
||||||
|
change := rapid.ByteRange(1, 255).Draw(t, "change")
|
||||||
|
s[changeIdx] = change
|
||||||
|
|
||||||
|
parsed, err := csexp.Parse(s)
|
||||||
|
test.Error(t, err)
|
||||||
|
test.Nil(t, parsed)
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCloneEqual(t *testing.T) {
|
func TestCloneEqual(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user