package narr_test import ( "fmt" "git.noahlan.cn/noahlan/ntool/narr" "git.noahlan.cn/noahlan/ntool/ntest/assert" "testing" ) func TestNewFormatter(t *testing.T) { arr := [2]string{"a", "b"} str := narr.FormatIndent(arr, " ") assert.Contains(t, str, "\n ") fmt.Println(str) str = narr.FormatIndent(arr, "") assert.NotContains(t, str, "\n ") assert.Eq(t, "[a, b]", str) fmt.Println(str) assert.Eq(t, "", narr.FormatIndent("invalid", "")) assert.Eq(t, "[]", narr.FormatIndent([]string{}, "")) }