[PATCH] Fixes broken test and output
Export this patch
---
db_test.go | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/db_test.go b/db_test.go
index c6808b3..f6a7c97 100644
--- a/db_test.go
+++ b/db_test.go
@@ -3,7 +3,6 @@ package litedoc_test
import (
"context"
"database/sql"
- "fmt"
"os"
"testing"
@@ -50,7 +49,7 @@ func TestImport(t *testing.T) {
t.Error(err)
}
- fmt.Println(photo)
+ t.Log(photo)
}
func TestExport(t *testing.T) {
@@ -97,20 +96,20 @@ func TestDocument(t *testing.T) {
if err != nil {
t.Error(err)
}
- fmt.Println(d1)
+ t.Log(d1)
err = db.Collection("test").Document("my-doc-1").Create(ctx, &d1)
if err != nil {
t.Error(err)
}
- fmt.Println(d1)
+ t.Log(d1)
var d2 doc
err = db.Collection("test").Document("my-doc").Get(ctx, &d2)
if err != nil {
t.Error(err)
}
- fmt.Println(d2)
+ t.Log(d2)
if d1.Name != d2.Name {
t.Error(".Name mismatch")
@@ -126,14 +125,16 @@ func TestDocument(t *testing.T) {
if err != nil {
t.Error(err)
}
- fmt.Println(len(docs))
+ t.Logf("len(docs): %d", len(docs))
for _, doc := range docs {
var d map[string]any
- doc.DataTo(&d)
- fmt.Println(doc.ID, d)
+ if err := doc.DataTo(&d); err != nil {
+ t.Errorf("unexpected error: %v", err)
+ }
+ t.Log(doc.ID, d)
}
- if len(docs) < 5 {
+ if len(docs) < 2 {
t.Error("not enough docs")
}
}
--
2.45.2