From d2329e1c261bb235bfa32692710434936b98533b Mon Sep 17 00:00:00 2001 From: Ethan Koenig Date: Wed, 8 Feb 2017 01:29:07 -0500 Subject: Use assert in legacy unit tests (#867) --- models/models_test.go | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'models/models_test.go') diff --git a/models/models_test.go b/models/models_test.go index f68590c509..9bf32f81fa 100644 --- a/models/models_test.go +++ b/models/models_test.go @@ -7,27 +7,19 @@ package models import ( "testing" - . "github.com/smartystreets/goconvey/convey" + "github.com/stretchr/testify/assert" ) func Test_parsePostgreSQLHostPort(t *testing.T) { - testSuites := []struct { - input string - host, port string - }{ - {"127.0.0.1:1234", "127.0.0.1", "1234"}, - {"127.0.0.1", "127.0.0.1", "5432"}, - {"[::1]:1234", "[::1]", "1234"}, - {"[::1]", "[::1]", "5432"}, - {"/tmp/pg.sock:1234", "/tmp/pg.sock", "1234"}, - {"/tmp/pg.sock", "/tmp/pg.sock", "5432"}, + test := func (input, expectedHost, expectedPort string) { + host, port := parsePostgreSQLHostPort(input) + assert.Equal(t, expectedHost, host) + assert.Equal(t, expectedPort, port) } - - Convey("Parse PostgreSQL host and port", t, func() { - for _, suite := range testSuites { - host, port := parsePostgreSQLHostPort(suite.input) - So(host, ShouldEqual, suite.host) - So(port, ShouldEqual, suite.port) - } - }) + test("127.0.0.1:1234", "127.0.0.1", "1234") + test("127.0.0.1", "127.0.0.1", "5432") + test("[::1]:1234", "[::1]", "1234") + test("[::1]", "[::1]", "5432") + test("/tmp/pg.sock:1234", "/tmp/pg.sock", "1234") + test("/tmp/pg.sock", "/tmp/pg.sock", "5432") } -- cgit v1.2.3