(t *testing.T)
| 84 | } |
| 85 | |
| 86 | func 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 | |
| 105 | func TestDSNParserInvalid(t *testing.T) { |
| 106 | var invalidDSNs = []string{ |