Skip to content

Commit cf948e4

Browse files
authored
TestDSNReformat: add more roundtrip checks (#1443)
Add more roundtrip checks for ParseDSN/FormatDSN.
1 parent 65ed3c5 commit cf948e4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: dsn_test.go

+10
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ func TestDSNReformat(t *testing.T) {
130130
res1 := fmt.Sprintf("%+v", cfg1)
131131

132132
dsn2 := cfg1.FormatDSN()
133+
if dsn2 != dsn1 {
134+
// Just log
135+
t.Logf("%d. %q reformated as %q", i, dsn1, dsn2)
136+
}
137+
133138
cfg2, err := ParseDSN(dsn2)
134139
if err != nil {
135140
t.Error(err.Error())
@@ -141,6 +146,11 @@ func TestDSNReformat(t *testing.T) {
141146
if res1 != res2 {
142147
t.Errorf("%d. %q does not match %q", i, res2, res1)
143148
}
149+
150+
dsn3 := cfg2.FormatDSN()
151+
if dsn3 != dsn2 {
152+
t.Errorf("%d. %q does not match %q", i, dsn2, dsn3)
153+
}
144154
})
145155
}
146156
}

0 commit comments

Comments
 (0)