mirror of
https://github.com/kataras/iris.git
synced 2025-12-21 20:07:04 +00:00
Update to v8.3.1 | MVC: RelPath and RelTmpl implemented. Read HISTORY.md
Read HISTORY.md https://github.com/kataras/iris/blob/master/HISTORY.md#sa-19-august-2017--v831 Former-commit-id: 23f7c1c0dc3bc64f27db591a9b22cd5934337891
This commit is contained in:
31
mvc/strutil_test.go
Normal file
31
mvc/strutil_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package mvc
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFindCtrlWords(t *testing.T) {
|
||||
var tests = map[string][]string{
|
||||
"UserController": {"user"},
|
||||
"UserPostController": {"user", "post"},
|
||||
"ProfileController": {"profile"},
|
||||
"UserProfileController": {"user", "profile"},
|
||||
"UserProfilePostController": {"user", "profile", "post"},
|
||||
"UserProfile": {"user", "profile"},
|
||||
"Profile": {"profile"},
|
||||
"User": {"user"},
|
||||
}
|
||||
|
||||
for ctrlName, expected := range tests {
|
||||
words := findCtrlWords(ctrlName)
|
||||
if len(expected) != len(words) {
|
||||
t.Fatalf("expected words and return don't have the same length: [%d] != [%d] | '%s' != '%s'",
|
||||
len(expected), len(words), expected, words)
|
||||
}
|
||||
for i, w := range words {
|
||||
if expected[i] != w {
|
||||
t.Fatalf("expected word is not equal with the return one: '%s' != '%s'", expected[i], w)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user