Skip to content

Commit 1948441

Browse files
committed
Fixed example tests not checking errors after connecting
1 parent f8df91f commit 1948441

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

example_query_select_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ func Example_Get() {
1919
Address: url,
2020
AuthKey: authKey,
2121
})
22+
if err != nil {
23+
log.Fatalf("Error connecting to DB: %s", err)
24+
}
2225

2326
// Setup table
2427
r.Db("test").TableDrop("table").Run(sess)
@@ -59,6 +62,9 @@ func Example_GetAll_Compound() {
5962
Address: url,
6063
AuthKey: authKey,
6164
})
65+
if err != nil {
66+
log.Fatalf("Error connecting to DB: %s", err)
67+
}
6268

6369
// Setup table
6470
r.Db("test").TableDrop("table").Run(sess)

example_query_table_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ func Example_TableCreate() {
1212
Address: url,
1313
AuthKey: authKey,
1414
})
15+
if err != nil {
16+
log.Fatalf("Error connecting to DB: %s", err)
17+
}
1518

1619
// Setup database
1720
r.Db("test").TableDrop("table").Run(sess)
@@ -32,6 +35,9 @@ func Example_IndexCreate() {
3235
Address: url,
3336
AuthKey: authKey,
3437
})
38+
if err != nil {
39+
log.Fatalf("Error connecting to DB: %s", err)
40+
}
3541

3642
// Setup database
3743
r.Db("test").TableDrop("table").Run(sess)
@@ -53,6 +59,9 @@ func Example_IndexCreate_compound() {
5359
Address: url,
5460
AuthKey: authKey,
5561
})
62+
if err != nil {
63+
log.Fatalf("Error connecting to DB: %s", err)
64+
}
5665

5766
// Setup database
5867
r.Db("test").TableDrop("table").Run(sess)

example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func Example() {
2828
AuthKey: authKey,
2929
})
3030
if err != nil {
31-
log.Fatalln(err.Error())
31+
log.Fatalf("Error connecting to DB: %s", err)
3232
}
3333

3434
res, err := r.Expr("Hello World").Run(session)

0 commit comments

Comments
 (0)