github.com/haraldrudell/parl@v0.4.176/pio/write-closer-to-string_test.go (about) 1 /* 2 © 2021–present Harald Rudell <harald.rudell@gmail.com> (https://haraldrudell.github.io/haraldrudell/) 3 ISC License 4 */ 5 6 package pio 7 8 import ( 9 "io" 10 "testing" 11 ) 12 13 func TestWriteCloserToString(t *testing.T) { 14 //t.Fail() 15 16 var writer io.WriteCloser 17 var n int 18 var err error 19 20 writer = NewCloserBuffer() 21 if err = writer.Close(); err != nil { 22 t.Errorf("NewWriteCloserToString.Close err: %v", err) 23 } 24 25 // writer.Write: n: 0 err: "pio.Write file alread closed 26 n, err = writer.Write([]byte{1}) 27 if err == nil { 28 t.Error("writer.Write err missing") 29 } 30 t.Logf("writer.Write: n: %d err: %q", n, err) 31 }