summaryrefslogtreecommitdiffstats
path: root/models/models_test.go
diff options
context:
space:
mode:
authorEthan Koenig <etk39@cornell.edu>2017-02-08 01:29:07 -0500
committerLunny Xiao <xiaolunwen@gmail.com>2017-02-08 14:29:07 +0800
commitd2329e1c261bb235bfa32692710434936b98533b (patch)
tree148096febc87256d680a697673e08accb6afa355 /models/models_test.go
parent23a7527e040a2ea6612db040544cf204b7969d55 (diff)
downloadgitea-d2329e1c261bb235bfa32692710434936b98533b.tar.gz
gitea-d2329e1c261bb235bfa32692710434936b98533b.zip
Use assert in legacy unit tests (#867)
Diffstat (limited to 'models/models_test.go')
-rw-r--r--models/models_test.go30
1 files changed, 11 insertions, 19 deletions
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")
}