Begin_test.go 372 B

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