Skip to content

Commit

Permalink
Merge pull request #1364 from BenLampson/master
Browse files Browse the repository at this point in the history
  • Loading branch information
kataras authored Oct 5, 2019
2 parents df88227 + 0e1af3f commit 2f844a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mvc/controller_method_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (l *methodLexer) reset(s string) {
}

if end > 0 && len(s) >= end {
words = append(words, s[start:end])
words = append(words, s[start:])
}
}

Expand Down
11 changes: 11 additions & 0 deletions mvc/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ func (c *testControllerRelPathFromFunc) GetSomethingByBy(string, int) {}
func (c *testControllerRelPathFromFunc) GetSomethingNewBy(string, int) {} // two input arguments, one By which is the latest word.
func (c *testControllerRelPathFromFunc) GetSomethingByElseThisBy(bool, int) {} // two input arguments

func (c *testControllerRelPathFromFunc) GetLocationX() {}
func (c *testControllerRelPathFromFunc) GetLocationXY() {}
func (c *testControllerRelPathFromFunc) GetLocationZBy(int) {}

func TestControllerRelPathFromFunc(t *testing.T) {
app := iris.New()
New(app).Handle(new(testControllerRelPathFromFunc))
Expand Down Expand Up @@ -449,6 +453,13 @@ func TestControllerRelPathFromFunc(t *testing.T) {
Body().Equal("GET:/42")
e.GET("/anything/here").Expect().Status(iris.StatusOK).
Body().Equal("GET:/anything/here")

e.GET("/location/x").Expect().Status(iris.StatusOK).
Body().Equal("GET:/location/x")
e.GET("/location/x/y").Expect().Status(iris.StatusOK).
Body().Equal("GET:/location/x/y")
e.GET("/location/z/42").Expect().Status(iris.StatusOK).
Body().Equal("GET:/location/z/42")
}

type testControllerActivateListener struct {
Expand Down

0 comments on commit 2f844a6

Please sign in to comment.