1
0
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:
kataras
2017-08-19 21:54:33 +03:00
parent 27f0e0b4b1
commit 8c1a4da804
11 changed files with 352 additions and 25 deletions

31
mvc/strutil_test.go Normal file
View 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)
}
}
}
}