From 047b7c22f8b7e9f713ee2c726a1c47eca12d9abe 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 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dsn_test.go b/dsn_test.go index a729d0ef8..f967177fe 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()) @@ -139,8 +144,14 @@ func TestDSNReformat(t *testing.T) { res2 := fmt.Sprintf("%+v", cfg2) if res1 != res2 { + t.Errorf("%d. %q does not match %q", i, dsn2, dsn1) 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) + } }) } }