mirror of
https://github.com/garethgeorge/backrest.git
synced 2025-12-12 16:55:39 +00:00
25 lines
439 B
Go
25 lines
439 B
Go
package restic
|
|
|
|
import "testing"
|
|
|
|
func TestOutputCapture(t *testing.T) {
|
|
c := newOutputCapturer(100)
|
|
|
|
c.Write([]byte("hello"))
|
|
|
|
if c.String() != "hello" {
|
|
t.Errorf("expected 'hello', got '%s'", c.String())
|
|
}
|
|
}
|
|
|
|
func TestOutputCaptureDrops(t *testing.T) {
|
|
c := newOutputCapturer(2)
|
|
|
|
c.Write([]byte("hello"))
|
|
|
|
want := "h...[3 bytes dropped]...o"
|
|
if c.String() != want {
|
|
t.Errorf("expected '%s', got '%s'", want, c.String())
|
|
}
|
|
}
|