pkg/stringutil: sort 'ss' in TestUniqueStrings

From the algorithm below, 'ss' should be sorted.

Also removes 'fmt.Println', because the idiomatic tests would not print.

Signed-off-by: Jes Cok <xigua67damn@gmail.com>
This commit is contained in:
Jes Cok 2023-09-27 22:41:16 +08:00
parent 55253cee1b
commit eef8636f35

View File

@ -15,16 +15,16 @@
package stringutil
import (
"fmt"
"sort"
"testing"
)
func TestUniqueStrings(t *testing.T) {
ss := UniqueStrings(10, 50)
sort.Strings(ss)
for i := 1; i < len(ss); i++ {
if ss[i-1] == ss[i] {
t.Fatalf("ss[i-1] %q == ss[i] %q", ss[i-1], ss[i])
}
}
fmt.Println(ss)
}