Skip to content

Commit

Permalink
Foramtter: add multi-function test.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDOS committed Sep 4, 2022
1 parent e7ccdf4 commit 73886d7
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,36 @@ func Test_FormatMain(t *testing.T) {
testFormat(t, "main.go", contents, want)
}

func Test_FormatMultipleFunctions(t *testing.T) {
contents := `package main
// @Produce json
// @Success 200 {object} string
// @Failure 400 {object} string
func A() {}
// @Description Description of B.
// @Produce json
// @Success 200 {array} string
// @Failure 400 {object} string
func B() {}`

want := `package main
// @Produce json
// @Success 200 {object} string
// @Failure 400 {object} string
func A() {}
// @Description Description of B.
// @Produce json
// @Success 200 {array} string
// @Failure 400 {object} string
func B() {}`

testFormat(t, "main.go", contents, want)
}

func Test_FormatApi(t *testing.T) {
contents := `package api
Expand Down

0 comments on commit 73886d7

Please sign in to comment.