github.com/bingoohuang/gg@v0.0.0-20240325092523-45da7dee9335/pkg/sqx/db_test.go (about) 1 package sqx 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestTryUrlEncodePass(t *testing.T) { 10 assert.Equal(t, "postgres://SYSTEM:abc123%21%40%40%23@192.168.1.2:54321/mydb?sslmode=disable", tryUrlEncodePass("pgx", "postgres://SYSTEM:abc123!@@#@192.168.1.2:54321/mydb?sslmode=disable")) 11 assert.Equal(t, "postgres://SYSTEM:abc123@192.168.1.2:54321/mydb?sslmode=disable", tryUrlEncodePass("pgx", "postgres://SYSTEM:abc123@192.168.1.2:54321/mydb?sslmode=disable")) 12 }