mirror of
https://github.com/safing/portbase
synced 2026-05-01 21:21:23 +00:00
Add Prepend* and HoldsData functions, remove error carrying
This commit is contained in:
parent
52b0683882
commit
adedde1310
2 changed files with 38 additions and 33 deletions
|
|
@ -2,7 +2,6 @@ package container
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/safing/portbase/utils"
|
||||
|
|
@ -82,38 +81,6 @@ func compareMany(t *testing.T, reference []byte, other ...[]byte) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestContainerErrorHandling(t *testing.T) {
|
||||
|
||||
c1 := New(nil)
|
||||
|
||||
if c1.HasError() {
|
||||
t.Error("should not have error")
|
||||
}
|
||||
|
||||
c1.SetError(errors.New("test error"))
|
||||
|
||||
if !c1.HasError() {
|
||||
t.Error("should have error")
|
||||
}
|
||||
|
||||
c2 := New(append([]byte{0}, []byte("test error")...))
|
||||
|
||||
if c2.HasError() {
|
||||
t.Error("should not have error")
|
||||
}
|
||||
|
||||
c2.CheckError()
|
||||
|
||||
if !c2.HasError() {
|
||||
t.Error("should have error")
|
||||
}
|
||||
|
||||
if c2.Error().Error() != "test error" {
|
||||
t.Errorf("error message mismatch, was %s", c2.Error())
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestDataFetching(t *testing.T) {
|
||||
c1 := New(utils.DuplicateBytes(testData))
|
||||
data := c1.GetMax(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue