working sections version
This commit is contained in:
parent
16ea95bf09
commit
9424084a36
28 changed files with 367 additions and 251 deletions
|
|
@ -48,7 +48,11 @@ func StoreTitle(section, title string) string {
|
|||
}
|
||||
|
||||
func SplitStoreTitle(st string) (section, title string) {
|
||||
if a := strings.Split(st, "/"); len(a) == 2 {
|
||||
a := strings.Split(st, "/")
|
||||
switch len(a) {
|
||||
case 1:
|
||||
return a[0], ""
|
||||
case 2:
|
||||
return a[0], a[1]
|
||||
}
|
||||
return
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ func TestTitleFunctions(t *testing.T) {
|
|||
t.Fail()
|
||||
}
|
||||
})
|
||||
t.Run("SplitStoreTitleSingle", func(t *testing.T) {
|
||||
se, ti := SplitStoreTitle(section)
|
||||
if se != section || ti != "" {
|
||||
t.Fail()
|
||||
}
|
||||
})
|
||||
t.Run("Title", func(t *testing.T) {
|
||||
if Title("9ßw$%4h4t-8v74 287(G /SV&3[45v}=94#+?)") != "9w4h4t-8v74+287G+SV345v94" {
|
||||
t.Fail()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue