From f8dc6426bb736055351491b90db69509795b153f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Mengu=C3=A9?= Date: Thu, 1 Jun 2023 22:37:12 +0200 Subject: [PATCH] TestDSNReformat: add more roundtrip checks Add more roundtrip checks for ParseDSN/FormatDSN. --- dsn_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dsn_test.go b/dsn_test.go index a729d0ef8..be50102de 100644 --- a/dsn_test.go +++ b/dsn_test.go @@ -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()) @@ -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) + } }) } }