Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 34 for testPrinter (0.14 sec)

  1. staging/src/k8s.io/cli-runtime/pkg/printers/json_test.go

    }
    
    func (in *TestStruct) DeepCopyObject() runtime.Object {
    	panic("never called")
    }
    
    func TestJSONPrinter(t *testing.T) {
    	testPrinter(t, NewTypeSetter(scheme.Scheme).ToPrinter(&JSONPrinter{}), json.Unmarshal)
    }
    
    func testPrinter(t *testing.T, printer ResourcePrinter, unmarshalFunc func(data []byte, v interface{}) error) {
    	buf := bytes.NewBuffer([]byte{})
    
    	err := printer.PrintObj(&testData, buf)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 12 15:46:12 UTC 2023
    - 4K bytes
    - Viewed (0)
  2. staging/src/k8s.io/cli-runtime/pkg/printers/yaml_test.go

    limitations under the License.
    */
    
    package printers
    
    import (
    	"testing"
    
    	"sigs.k8s.io/yaml"
    
    	"k8s.io/client-go/kubernetes/scheme"
    )
    
    func TestYAMLPrinter(t *testing.T) {
    	testPrinter(t, NewTypeSetter(scheme.Scheme).ToPrinter(&YAMLPrinter{}), yamlUnmarshal)
    }
    
    func yamlUnmarshal(data []byte, v interface{}) error {
    	return yaml.Unmarshal(data, v)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Sep 10 11:23:25 UTC 2021
    - 888 bytes
    - Viewed (0)
  3. cmd/kubeadm/app/util/output/output.go

    	Printf(format string, args ...interface{}) (n int, err error)
    	Println(args ...interface{}) (n int, err error)
    }
    
    // TextPrinter implements Printer interface for generic text output
    type TextPrinter struct {
    }
    
    // PrintObj is an implementation of ResourcePrinter.PrintObj that prints object
    func (tp *TextPrinter) PrintObj(obj runtime.Object, writer io.Writer) error {
    	_, err := fmt.Fprintf(writer, "%+v\n", obj)
    	return err
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Apr 19 08:22:45 UTC 2024
    - 8K bytes
    - Viewed (0)
  4. pkg/kube/kclient/clienttest/test_helpers.go

    	c kclient.ReadWriter[T]
    	t test.Failer
    	TestWriter[T]
    }
    
    type TestWriter[T controllers.Object] struct {
    	c kclient.Writer[T]
    	t test.Failer
    }
    
    func (t TestClient[T]) Get(name, namespace string) T {
    	return t.c.Get(name, namespace)
    }
    
    func (t TestClient[T]) List(namespace string, selector klabels.Selector) []T {
    	return t.c.List(namespace, selector)
    }
    
    func (t TestWriter[T]) Create(object T) T {
    	t.t.Helper()
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Fri Feb 23 19:18:21 UTC 2024
    - 3.9K bytes
    - Viewed (0)
  5. src/go/doc/comment/text.go

    // license that can be found in the LICENSE file.
    
    package comment
    
    import (
    	"bytes"
    	"fmt"
    	"sort"
    	"strings"
    	"unicode/utf8"
    )
    
    // A textPrinter holds the state needed for printing a Doc as plain text.
    type textPrinter struct {
    	*Printer
    	long       strings.Builder
    	prefix     string
    	codePrefix string
    	width      int
    }
    
    // Text returns a textual formatting of the [Doc].
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 8.8K bytes
    - Viewed (0)
  6. src/mime/quotedprintable/writer_test.go

    // license that can be found in the LICENSE file.
    
    package quotedprintable
    
    import (
    	"bytes"
    	"io"
    	"strings"
    	"testing"
    )
    
    func TestWriter(t *testing.T) {
    	testWriter(t, false)
    }
    
    func TestWriterBinary(t *testing.T) {
    	testWriter(t, true)
    }
    
    func testWriter(t *testing.T, binary bool) {
    	tests := []struct {
    		in, want, wantB string
    	}{
    		{in: "", want: ""},
    		{in: "foo bar", want: "foo bar"},
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 06 17:36:47 UTC 2022
    - 5.1K bytes
    - Viewed (0)
  7. src/cmd/go/internal/modfetch/codehost/git_test.go

    func newTestWriter(t testing.TB) *testWriter {
    	w := &testWriter{t: t}
    
    	t.Cleanup(func() {
    		w.mu.Lock()
    		defer w.mu.Unlock()
    		if b := w.buf.Bytes(); len(b) > 0 {
    			w.t.Logf("%s", b)
    			w.buf.Reset()
    		}
    	})
    
    	return w
    }
    
    func (w *testWriter) Write(p []byte) (int, error) {
    	w.mu.Lock()
    	defer w.mu.Unlock()
    	n, err := w.buf.Write(p)
    	if b := w.buf.Bytes(); len(b) > 0 && b[len(b)-1] == '\n' {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Dec 14 19:46:23 UTC 2023
    - 18.9K bytes
    - Viewed (0)
  8. pkg/kube/kclient/clienttest/direct.go

    // NewWriter returns a new client for the given type.
    // Any errors will call t.Fatal.
    func NewWriter[T controllers.ComparableObject](t test.Failer, c kube.Client) TestWriter[T] {
    	return TestWriter[T]{t: t, c: kclient.NewWriteClient[T](c)}
    }
    
    // NewDirectClient returns a new client for the given type. Reads are directly to the API server.
    // Any errors will call t.Fatal.
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue Aug 08 16:43:05 UTC 2023
    - 3K bytes
    - Viewed (0)
  9. operator/pkg/util/progress/progress.go

    	return prefix + msg
    }
    
    // For testing only
    var testWriter *io.Writer
    
    func createBar() *pb.ProgressBar {
    	// Don't set a total and use Static so we can explicitly control when you write. This is needed
    	// for handling the multiline issues.
    	bar := pb.New(0)
    	bar.Set(pb.Static, true)
    	if testWriter != nil {
    		bar.SetWriter(*testWriter)
    	}
    	bar.Start()
    Registered: Fri Jun 14 15:00:06 UTC 2024
    - Last Modified: Tue May 14 19:23:44 UTC 2024
    - 6.2K bytes
    - Viewed (0)
  10. cmd/kubeadm/app/cmd/upgrade/common_test.go

    		},
    	}
    	for _, tt := range tcases {
    		t.Run(tt.name, func(t *testing.T) {
    			_, _, _, _, err := enforceRequirements(&pflag.FlagSet{}, &tt.flags, nil, tt.dryRun, false, &output.TextPrinter{})
    			if err == nil && len(tt.expectedErr) != 0 {
    				t.Error("Expected error, but got success")
    			}
    
    			expErr := tt.expectedErr
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Feb 29 05:14:21 UTC 2024
    - 5.5K bytes
    - Viewed (0)
Back to top