Skip to content

Commit

Permalink
TestDSNReformat: add more roundtrip checks (#1443)
Browse files Browse the repository at this point in the history
Add more roundtrip checks for ParseDSN/FormatDSN.
  • Loading branch information
dolmen committed Jun 13, 2023
1 parent 65ed3c5 commit cf948e4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dsn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ func TestDSNReformat(t *testing.T) {
res1 := fmt.Sprintf("%+v", cfg1)

dsn2 := cfg1.FormatDSN()
if dsn2 != dsn1 {
// Just log
t.Logf("%d. %q reformated as %q", i, dsn1, dsn2)
}

cfg2, err := ParseDSN(dsn2)
if err != nil {
t.Error(err.Error())
Expand All @@ -141,6 +146,11 @@ func TestDSNReformat(t *testing.T) {
if res1 != res2 {
t.Errorf("%d. %q does not match %q", i, res2, res1)
}

dsn3 := cfg2.FormatDSN()
if dsn3 != dsn2 {
t.Errorf("%d. %q does not match %q", i, dsn2, dsn3)
}
})
}
}
Expand Down

0 comments on commit cf948e4

Please sign in to comment.