github.com/damirazo/docker@v1.9.0/pkg/ioutils/fmt_test.go (about)

     1  package ioutils
     2  
     3  import "testing"
     4  
     5  func TestFprintfIfNotEmpty(t *testing.T) {
     6  	wc := NewWriteCounter(&NopWriter{})
     7  	n, _ := FprintfIfNotEmpty(wc, "foo%s", "")
     8  
     9  	if wc.Count != 0 || n != 0 {
    10  		t.Errorf("Wrong count: %v vs. %v vs. 0", wc.Count, n)
    11  	}
    12  
    13  	n, _ = FprintfIfNotEmpty(wc, "foo%s", "bar")
    14  	if wc.Count != 6 || n != 6 {
    15  		t.Errorf("Wrong count: %v vs. %v vs. 6", wc.Count, n)
    16  	}
    17  }