Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for joinStrings (0.32 sec)

  1. src/cmd/doc/pkg.go

    	}
    	if len(names) == 0 {
    		return pkg.oneLineNodeDepth(field.Type, depth)
    	}
    	return joinStrings(names) + " " + pkg.oneLineNodeDepth(field.Type, depth)
    }
    
    // joinStrings formats the input as a comma-separated list,
    // but truncates the list at some reasonable length if necessary.
    func joinStrings(ss []string) string {
    	var n int
    	for i, s := range ss {
    		n += len(s) + len(", ")
    		if n > punchedCardWidth {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 08 20:15:52 UTC 2024
    - 32K bytes
    - Viewed (0)
  2. pkg/test/util/yml/parts.go

    	for _, part := range parts {
    		part := strings.TrimSpace(part)
    		if len(part) > 0 {
    			out = append(out, part)
    		}
    	}
    	return out
    }
    
    // JoinString joins the given yaml parts into a single multipart document.
    func JoinString(parts ...string) string {
    	// Assume that each part is already a multi-document. Split and trim each part,
    	// if necessary.
    	toJoin := make([]string, 0, len(parts))
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Nov 03 08:41:32 UTC 2022
    - 2.6K bytes
    - Viewed (0)
  3. pkg/test/util/yml/parts_test.go

    	"istio.io/istio/pkg/test/util/yml"
    )
    
    func TestEmptyDoc(t *testing.T) {
    	g := NewWithT(t)
    
    	yaml := `
    `
    	parts := yml.SplitString(yaml)
    	g.Expect(len(parts)).To(Equal(0))
    
    	yaml = yml.JoinString(parts...)
    	g.Expect(yaml).To(Equal(""))
    }
    
    func TestSplitWithEmptyPart(t *testing.T) {
    	expected := []string{
    		"a",
    		"b",
    	}
    
    	cases := []struct {
    		name string
    		doc  string
    	}{
    		{
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Oct 31 14:48:28 UTC 2023
    - 1.8K bytes
    - Viewed (0)
  4. pilot/pkg/config/file/util/kubeyaml/kubeyaml.go

    			}
    			b.WriteString(yamlSeparator)
    		}
    		_, _ = b.Write(p)
    		s := string(p)
    		lastIsNewLine = s[len(s)-1] == '\n'
    	}
    
    	return b.Bytes()
    }
    
    // JoinString joins the given yaml parts into a single multipart document.
    func JoinString(parts ...string) string {
    	var st strings.Builder
    
    	var lastIsNewLine bool
    	for _, p := range parts {
    		if len(p) == 0 {
    			continue
    		}
    		if st.Len() != 0 {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Apr 12 02:41:40 UTC 2022
    - 3.5K bytes
    - Viewed (0)
  5. pkg/config/analysis/local/analyze_test.go

    	tmpfile := tempFileFromString(t, JoinString(YamlN1I1V1, "bogus resource entry\n"))
    	defer func() { _ = os.Remove(tmpfile.Name()) }()
    
    	err := sa.AddReaderKubeSource([]ReaderSource{{Reader: tmpfile}})
    	g.Expect(err).To(Not(BeNil()))
    }
    
    const (
    	yamlSeparator = "---\n"
    )
    
    // JoinString joins the given yaml parts into a single multipart document.
    func JoinString(parts ...string) string {
    	var st strings.Builder
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Jan 09 07:43:43 UTC 2024
    - 9.6K bytes
    - Viewed (0)
  6. pilot/pkg/config/file/util/kubeyaml/kubeyaml_test.go

    		})
    	}
    }
    
    func TestJoinString(t *testing.T) {
    	for i, c := range joinCases {
    		t.Run(fmt.Sprintf("%d", i), func(t *testing.T) {
    			g := NewWithT(t)
    
    			actual := JoinString(c.split...)
    
    			g.Expect(actual).To(Equal(c.merged))
    		})
    	}
    }
    
    func TestLineNumber(t *testing.T) {
    	testCases := []struct {
    		input       string
    		lineNumbers []int
    	}{
    		{
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Oct 31 14:48:28 UTC 2023
    - 2.5K bytes
    - Viewed (0)
  7. pkg/test/util/yml/apply.go

    	toJoin := make([]string, 0, len(chunks))
    	for _, chunk := range chunks {
    		chunk, err := applyNamespace(chunk, ns)
    		if err != nil {
    			return "", err
    		}
    		toJoin = append(toJoin, chunk)
    	}
    
    	result := JoinString(toJoin...)
    	return result, nil
    }
    
    // ApplyPullSecrets applies the given pullsecret to the deployment resource
    func ApplyPullSecret(deploymentYaml string, pullSecret string) (string, error) {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Oct 17 07:02:38 UTC 2023
    - 3.8K bytes
    - Viewed (0)
  8. pkg/test/util/yml/file.go

    }
    
    // WriteYAML writes the given YAML content to one or more YAML files.
    func (w *writerImpl) WriteYAML(filenamePrefix string, contents ...string) ([]string, error) {
    	out := make([]string, 0, len(contents))
    	content := JoinString(contents...)
    	files, err := splitContentsToFiles(w.workDir, content, filenamePrefix)
    	if err != nil {
    		return nil, err
    	}
    
    	if len(files) == 0 {
    		f, err := writeContentsToTempFile(w.workDir, content)
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Sep 07 14:33:54 UTC 2023
    - 4.2K bytes
    - Viewed (0)
  9. pkg/test/framework/components/jwt/kube.go

    	res := yml.SplitString(resource)
    	updatedYaml, err := yml.ApplyPullSecret(res[2], pullSecret)
    	if err != nil {
    		return "", err
    	}
    	mergedYaml := yml.JoinString(res[0], res[1], updatedYaml)
    	return mergedYaml, nil
    }
    
    type serverImpl struct {
    	id resource.ID
    	ns namespace.Instance
    }
    
    func (s *serverImpl) FQDN() string {
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Sep 22 23:45:43 UTC 2022
    - 4K bytes
    - Viewed (0)
  10. pkg/test/framework/components/istio/util.go

    		}
    	}
    	return addrs, true, nil
    }
    
    func removeCRDsSlice(raw []string) string {
    	res := make([]string, 0)
    	for _, r := range raw {
    		res = append(res, removeCRDs(r))
    	}
    	return yml.JoinString(res...)
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Thu Feb 29 17:13:34 UTC 2024
    - 4.7K bytes
    - Viewed (0)
Back to top