BeginTx_test.go 415 B

12345678910111213141516171819202122
  1. package unittest
  2. import (
  3. "context"
  4. "database/sql"
  5. "fmt"
  6. "testing"
  7. "xugugodriver/go_unit/unittest"
  8. )
  9. func TestDbBeginTx(t *testing.T) {
  10. testdb, err := sql.Open("xugusql", unittest.Dsn)
  11. if err != nil {
  12. fmt.Printf("[ERROR] %s\n", err.Error())
  13. }
  14. _, begin_err := testdb.BeginTx(context.Background(), nil)
  15. if begin_err != nil {
  16. t.Errorf("TestDbBeginTx FAIL.")
  17. }
  18. testdb.Close()
  19. }