fix test to actually work reliably
This commit is contained in:
parent
8581e73cef
commit
056d74901e
@ -14,6 +14,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -588,14 +589,21 @@ func TestBatchString(t *testing.T) {
|
|||||||
batch.SetInternal([]byte("c"), []byte{})
|
batch.SetInternal([]byte("c"), []byte{})
|
||||||
batch.DeleteInternal([]byte("d"))
|
batch.DeleteInternal([]byte("d"))
|
||||||
|
|
||||||
expectedBatchStr := `Batch (2 ops, 2 internal ops)
|
|
||||||
INDEX - 'a'
|
|
||||||
DELETE - 'b'
|
|
||||||
SET INTERNAL - 'c'
|
|
||||||
DELETE INTERNAL - 'd'
|
|
||||||
`
|
|
||||||
batchStr := batch.String()
|
batchStr := batch.String()
|
||||||
if batchStr != expectedBatchStr {
|
if !strings.HasPrefix(batchStr, "Batch (2 ops, 2 internal ops)") {
|
||||||
t.Errorf("expected: %s\ngot: %s", expectedBatchStr, batchStr)
|
t.Errorf("expected to start with Batch (2 ops, 2 internal ops), did not")
|
||||||
}
|
}
|
||||||
|
if !strings.Contains(batchStr, "INDEX - 'a'") {
|
||||||
|
t.Errorf("expected to contain INDEX - 'a', did not")
|
||||||
|
}
|
||||||
|
if !strings.Contains(batchStr, "DELETE - 'b'") {
|
||||||
|
t.Errorf("expected to contain DELETE - 'b', did not")
|
||||||
|
}
|
||||||
|
if !strings.Contains(batchStr, "SET INTERNAL - 'c'") {
|
||||||
|
t.Errorf("expected to contain SET INTERNAL - 'c', did not")
|
||||||
|
}
|
||||||
|
if !strings.Contains(batchStr, "DELETE INTERNAL - 'd'") {
|
||||||
|
t.Errorf("expected to contain DELETE INTERNAL - 'd', did not")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user