MCPcopy
hub / github.com/go-sql-driver/mysql / TestDSNParser

Function TestDSNParser

dsn_test.go:86–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

84}
85
86func TestDSNParser(t *testing.T) {
87 for i, tst := range testDSNs {
88 t.Run(tst.in, func(t *testing.T) {
89 cfg, err := ParseDSN(tst.in)
90 if err != nil {
91 t.Error(err.Error())
92 return
93 }
94
95 // pointer not static
96 cfg.TLS = nil
97
98 if !reflect.DeepEqual(cfg, tst.out) {
99 t.Errorf("%d. ParseDSN(%q) mismatch:\ngot %+v\nwant %+v", i, tst.in, cfg, tst.out)
100 }
101 })
102 }
103}
104
105func TestDSNParserInvalid(t *testing.T) {
106 var invalidDSNs = []string{

Callers

nothing calls this directly

Calls 2

ParseDSNFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected