3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-12-22 10:42:52 +01:00

Fix issue with one-character args in ArgsToStrings.

This commit is contained in:
Alex Jaspersen 2020-05-30 15:45:43 +00:00
parent c1d4c5596d
commit 2cb91bab04
2 changed files with 9 additions and 1 deletions

View File

@ -35,7 +35,7 @@ func ArgsToStrings(maxLength int, arguments []string, delim string) []string {
continue
}
if len(buffer) > 1 {
if len(buffer) > 0 {
buffer += delim
}
buffer += arguments[0]

View File

@ -5,6 +5,14 @@ package utils
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) {
val, err := StringToBool("on")
assertEqual(val, true, t)