mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-10 22:19:31 +01:00
Fix issue with one-character args in ArgsToStrings.
This commit is contained in:
parent
c1d4c5596d
commit
2cb91bab04
@ -35,7 +35,7 @@ func ArgsToStrings(maxLength int, arguments []string, delim string) []string {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(buffer) > 1 {
|
if len(buffer) > 0 {
|
||||||
buffer += delim
|
buffer += delim
|
||||||
}
|
}
|
||||||
buffer += arguments[0]
|
buffer += arguments[0]
|
||||||
|
@ -5,6 +5,14 @@ package utils
|
|||||||
|
|
||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
|
func TestArgsToStrings(t *testing.T) {
|
||||||
|
val := ArgsToStrings(512, []string{"a", "b", "c"}, ",")
|
||||||
|
assertEqual(val, []string{"a,b,c"}, t)
|
||||||
|
|
||||||
|
val = ArgsToStrings(10, []string{"abcd", "efgh", "ijkl"}, ",")
|
||||||
|
assertEqual(val, []string{"abcd,efgh", "ijkl"}, t)
|
||||||
|
}
|
||||||
|
|
||||||
func TestStringToBool(t *testing.T) {
|
func TestStringToBool(t *testing.T) {
|
||||||
val, err := StringToBool("on")
|
val, err := StringToBool("on")
|
||||||
assertEqual(val, true, t)
|
assertEqual(val, true, t)
|
||||||
|
Loading…
Reference in New Issue
Block a user